From 7e668469923222f60caeedf92385026cf931faa0 Mon Sep 17 00:00:00 2001 From: Jack Steiner Date: Wed, 26 May 2010 14:42:49 -0700 Subject: [PATCH] --- yaml --- r: 198731 b: refs/heads/master c: 6adef3ebe570bcde67fd6c16101451ddde5712b5 h: refs/heads/master i: 198729: af1689f206087b505ff0d05d93ae5591bc0f2715 198727: efd273078749353cc5cc039f82f4aa77bbf9156b v: v3 --- [refs] | 2 +- trunk/include/linux/cpuset.h | 6 ++++++ trunk/include/linux/sched.h | 1 + trunk/kernel/cpuset.c | 20 ++++++++++++++++---- trunk/mm/slab.c | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index a8c32a74bd5c..fb10976fe50d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2c488db27b614816024e7994117f599337de0f34 +refs/heads/master: 6adef3ebe570bcde67fd6c16101451ddde5712b5 diff --git a/trunk/include/linux/cpuset.h b/trunk/include/linux/cpuset.h index 20b51cab6593..457ed765a116 100644 --- a/trunk/include/linux/cpuset.h +++ b/trunk/include/linux/cpuset.h @@ -69,6 +69,7 @@ extern void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task); extern int cpuset_mem_spread_node(void); +extern int cpuset_slab_spread_node(void); static inline int cpuset_do_page_mem_spread(void) { @@ -194,6 +195,11 @@ static inline int cpuset_mem_spread_node(void) return 0; } +static inline int cpuset_slab_spread_node(void) +{ + return 0; +} + static inline int cpuset_do_page_mem_spread(void) { return 0; diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index c0151ffd3541..4f31a166b1a1 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1423,6 +1423,7 @@ struct task_struct { nodemask_t mems_allowed; /* Protected by alloc_lock */ int mems_allowed_change_disable; int cpuset_mem_spread_rotor; + int cpuset_slab_spread_rotor; #endif #ifdef CONFIG_CGROUPS /* Control Group info protected by css_set_lock */ diff --git a/trunk/kernel/cpuset.c b/trunk/kernel/cpuset.c index 61d6af7fa676..02b9611eadde 100644 --- a/trunk/kernel/cpuset.c +++ b/trunk/kernel/cpuset.c @@ -2469,7 +2469,8 @@ void cpuset_unlock(void) } /** - * cpuset_mem_spread_node() - On which node to begin search for a page + * cpuset_mem_spread_node() - On which node to begin search for a file page + * cpuset_slab_spread_node() - On which node to begin search for a slab page * * If a task is marked PF_SPREAD_PAGE or PF_SPREAD_SLAB (as for * tasks in a cpuset with is_spread_page or is_spread_slab set), @@ -2494,16 +2495,27 @@ void cpuset_unlock(void) * See kmem_cache_alloc_node(). */ -int cpuset_mem_spread_node(void) +static int cpuset_spread_node(int *rotor) { int node; - node = next_node(current->cpuset_mem_spread_rotor, current->mems_allowed); + node = next_node(*rotor, current->mems_allowed); if (node == MAX_NUMNODES) node = first_node(current->mems_allowed); - current->cpuset_mem_spread_rotor = node; + *rotor = node; return node; } + +int cpuset_mem_spread_node(void) +{ + return cpuset_spread_node(¤t->cpuset_mem_spread_rotor); +} + +int cpuset_slab_spread_node(void) +{ + return cpuset_spread_node(¤t->cpuset_slab_spread_rotor); +} + EXPORT_SYMBOL_GPL(cpuset_mem_spread_node); /** diff --git a/trunk/mm/slab.c b/trunk/mm/slab.c index 02786e1a32d2..8270ba3d1986 100644 --- a/trunk/mm/slab.c +++ b/trunk/mm/slab.c @@ -3219,7 +3219,7 @@ static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags) nid_alloc = nid_here = numa_node_id(); get_mems_allowed(); if (cpuset_do_slab_mem_spread() && (cachep->flags & SLAB_MEM_SPREAD)) - nid_alloc = cpuset_mem_spread_node(); + nid_alloc = cpuset_slab_spread_node(); else if (current->mempolicy) nid_alloc = slab_node(current->mempolicy); put_mems_allowed();