From 36650c9de36801d4126d1cccbb0e085c6f601e1c Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Thu, 31 May 2012 16:26:22 -0700 Subject: [PATCH] --- yaml --- r: 309745 b: refs/heads/master c: cb79295e20a8088a2fd6a9b3cb5f2d889ec36b4d h: refs/heads/master i: 309743: 70e36d3c9fc89ff49c8602408809be2527d7b3cb v: v3 --- [refs] | 2 +- trunk/include/linux/cpu.h | 1 + trunk/kernel/cpu.c | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5e3f78c8e9e1..9c43af4e0312 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f7505d64f2db5da2d7d94873ddf2cd2524847061 +refs/heads/master: cb79295e20a8088a2fd6a9b3cb5f2d889ec36b4d diff --git a/trunk/include/linux/cpu.h b/trunk/include/linux/cpu.h index 7230bb59a06f..2e9b9ebbeb78 100644 --- a/trunk/include/linux/cpu.h +++ b/trunk/include/linux/cpu.h @@ -177,6 +177,7 @@ extern void put_online_cpus(void); #define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) +void clear_tasks_mm_cpumask(int cpu); int cpu_down(unsigned int cpu); #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE diff --git a/trunk/kernel/cpu.c b/trunk/kernel/cpu.c index 0e6353cf147a..0575197deb4a 100644 --- a/trunk/kernel/cpu.c +++ b/trunk/kernel/cpu.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include #include @@ -173,6 +175,30 @@ void __ref unregister_cpu_notifier(struct notifier_block *nb) } EXPORT_SYMBOL(unregister_cpu_notifier); +void clear_tasks_mm_cpumask(int cpu) +{ + struct task_struct *p; + + /* + * This function is called after the cpu is taken down and marked + * offline, so its not like new tasks will ever get this cpu set in + * their mm mask. -- Peter Zijlstra + * Thus, we may use rcu_read_lock() here, instead of grabbing + * full-fledged tasklist_lock. + */ + rcu_read_lock(); + for_each_process(p) { + struct task_struct *t; + + t = find_lock_task_mm(p); + if (!t) + continue; + cpumask_clear_cpu(cpu, mm_cpumask(t->mm)); + task_unlock(t); + } + rcu_read_unlock(); +} + static inline void check_for_tasks(int cpu) { struct task_struct *p;