提交 03a285f5 编写于 作者: P Paul Jackson 提交者: Linus Torvalds

[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: NPaul Jackson <pj@sgi.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7edc5962
...@@ -647,10 +647,15 @@ void cpuset_update_task_memory_state() ...@@ -647,10 +647,15 @@ void cpuset_update_task_memory_state()
struct task_struct *tsk = current; struct task_struct *tsk = current;
struct cpuset *cs; struct cpuset *cs;
rcu_read_lock(); if (tsk->cpuset == &top_cpuset) {
cs = rcu_dereference(tsk->cpuset); /* Don't need rcu for top_cpuset. It's never freed. */
my_cpusets_mem_gen = cs->mems_generation; my_cpusets_mem_gen = top_cpuset.mems_generation;
rcu_read_unlock(); } 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) { if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) {
down(&callback_sem); down(&callback_sem);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册