linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] percpu: stop the loop when a cpu belongs to a new group
@ 2013-10-21  8:58 Wei Yang
  2013-10-21  8:58 ` [PATCH 2/3] percpu: merge two loops when setting up group info Wei Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Wei Yang @ 2013-10-21  8:58 UTC (permalink / raw)
  To: tj, cl, linux-mm, linux-kernel; +Cc: weiyang

When a cpu belongs to a new group, there is no cpu has the same group id. This
means it can be assigned a new group id without checking with every others.

This patch does this optimiztion.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
 mm/percpu.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 8c8e08f..536ca4f 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1488,7 +1488,10 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
 			    (cpu_distance_fn(cpu, tcpu) > LOCAL_DISTANCE ||
 			     cpu_distance_fn(tcpu, cpu) > LOCAL_DISTANCE)) {
 				group++;
-				nr_groups = max(nr_groups, group + 1);
+				if (group == nr_groups) {
+					nr_groups++;
+					break;
+				}
 				goto next_group;
 			}
 		}
-- 
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-11-24  1:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21  8:58 [PATCH 1/3] percpu: stop the loop when a cpu belongs to a new group Wei Yang
2013-10-21  8:58 ` [PATCH 2/3] percpu: merge two loops when setting up group info Wei Yang
2013-10-27 12:35   ` Tejun Heo
2013-10-28  2:37     ` Wei Yang
2013-10-21  8:58 ` [PATCH 3/3] percpu: little optimization on calculating pcpu_unit_size Wei Yang
2013-10-27 12:36   ` Tejun Heo
2013-10-28  2:43     ` Wei Yang
2013-10-27 12:30 ` [PATCH 1/3] percpu: stop the loop when a cpu belongs to a new group Tejun Heo
2013-10-28  3:00   ` Wei Yang
2013-10-28 11:31     ` Tejun Heo
2013-10-28 15:17       ` Wei Yang
2013-11-20  3:00         ` Wei Yang
2013-11-20  5:51           ` Tejun Heo
2013-11-20  6:58             ` Wei Yang
2013-11-22 23:04             ` Tejun Heo
2013-11-24  1:48               ` Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).