aboutsummaryrefslogtreecommitdiff
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorPaul Jackson <pj@sgi.com>2006-01-08 01:02:04 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 20:13:45 -0800
commit03a285f58064b8e0af08383e082e383753d9c33e (patch)
treeaf458f3357d4e2d01dc04d2d41a7dd7d502c4755 /kernel/cpuset.c
parent7edc59628b2f5d6516b4677b3b56f5f056e45cd9 (diff)
[PATCH] cpuset: skip rcu check if task is in root cpuset
For systems that aren't using cpusets, but have them CONFIG_CPUSET enabled in their kernel (eventually this may be most distribution kernels), this patch removes even the minimal rcu_read_lock() from the memory page allocation path. Actually, it removes that rcu call for any task that is in the root cpuset (top_cpuset), which on systems not actively using cpusets, is all tasks. We don't need the rcu check for tasks in the top_cpuset, because the top_cpuset is statically allocated, so at no risk of being freed out from underneath us. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 681a5d58d40..e04c2da9dad 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -647,10 +647,15 @@ void cpuset_update_task_memory_state()
struct task_struct *tsk = current;
struct cpuset *cs;
- rcu_read_lock();
- cs = rcu_dereference(tsk->cpuset);
- my_cpusets_mem_gen = cs->mems_generation;
- rcu_read_unlock();
+ if (tsk->cpuset == &top_cpuset) {
+ /* Don't need rcu for top_cpuset. It's never freed. */
+ my_cpusets_mem_gen = top_cpuset.mems_generation;
+ } else {
+ rcu_read_lock();
+ cs = rcu_dereference(tsk->cpuset);
+ my_cpusets_mem_gen = cs->mems_generation;
+ rcu_read_unlock();
+ }
if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) {
down(&callback_sem);