aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux-foundation.org>2009-06-16 18:32:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:35 -0400
commit62bc62a873116805774ffd37d7f86aa4faa832b1 (patch)
tree7f3f5b94b2d484a13ca27b8d3f6f54cfe126d7c0 /mm/slub.c
parent974709bdb2a34db378fc84140220f363f558d0d6 (diff)
page allocator: use a pre-calculated value instead of num_online_nodes() in fast paths
num_online_nodes() is called in a number of places but most often by the page allocator when deciding whether the zonelist needs to be filtered based on cpusets or the zonelist cache. This is actually a heavy function and touches a number of cache lines. This patch stores the number of online nodes at boot time and updates the value when nodes get onlined and offlined. The value is then used in a number of important paths in place of num_online_nodes(). [rientjes@google.com: do not override definition of node_set_online() with macro] Signed-off-by: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Mel Gorman <mel@csn.ul.ie> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Dave Hansen <dave@linux.vnet.ibm.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 30354bfeb43d..1c950775d6be 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3737,7 +3737,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
3737 to_cpumask(l->cpus)); 3737 to_cpumask(l->cpus));
3738 } 3738 }
3739 3739
3740 if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && 3740 if (nr_online_nodes > 1 && !nodes_empty(l->nodes) &&
3741 len < PAGE_SIZE - 60) { 3741 len < PAGE_SIZE - 60) {
3742 len += sprintf(buf + len, " nodes="); 3742 len += sprintf(buf + len, " nodes=");
3743 len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50, 3743 len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50,