[PATCH 04/04] Cpuset: skip rcu check if task is in root cpuset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

---

 kernel/cpuset.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

--- 2.6.15-rc3-mm1.orig/kernel/cpuset.c	2005-12-13 18:14:42.529952708 -0800
+++ 2.6.15-rc3-mm1/kernel/cpuset.c	2005-12-13 20:54:26.323911532 -0800
@@ -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);

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux