[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1382345893-6644-2-git-send-email-weiyang@linux.vnet.ibm.com>
Date: Mon, 21 Oct 2013 16:58:12 +0800
From: Wei Yang <weiyang@...ux.vnet.ibm.com>
To: tj@...nel.org, cl@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: weiyang@...ux.vnet.ibm.com
Subject: [PATCH 2/3] percpu: merge two loops when setting up group info
There are two loops setting up the group info of pcpu_alloc_info. They share
the same logic, so merge them could be time efficient when there are many
groups.
This patch merge these two loops into one.
Signed-off-by: Wei Yang <weiyang@...ux.vnet.ibm.com>
---
mm/percpu.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 536ca4f..4f710a4f 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1542,11 +1542,6 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
return ERR_PTR(-ENOMEM);
cpu_map = ai->groups[0].cpu_map;
- for (group = 0; group < nr_groups; group++) {
- ai->groups[group].cpu_map = cpu_map;
- cpu_map += roundup(group_cnt[group], upa);
- }
-
ai->static_size = static_size;
ai->reserved_size = reserved_size;
ai->dyn_size = dyn_size;
@@ -1557,6 +1552,8 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
for (group = 0, unit = 0; group_cnt[group]; group++) {
struct pcpu_group_info *gi = &ai->groups[group];
+ gi->cpu_map = cpu_map;
+
/*
* Initialize base_offset as if all groups are located
* back-to-back. The caller should update this to
@@ -1568,6 +1565,7 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
if (group_map[cpu] == group)
gi->cpu_map[gi->nr_units++] = cpu;
gi->nr_units = roundup(gi->nr_units, upa);
+ cpu_map += gi->nr_units;
unit += gi->nr_units;
}
BUG_ON(unit != nr_units);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists