aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 0e6353cf147a..0575197deb4a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -10,6 +10,8 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/unistd.h> 11#include <linux/unistd.h>
12#include <linux/cpu.h> 12#include <linux/cpu.h>
13#include <linux/oom.h>
14#include <linux/rcupdate.h>
13#include <linux/export.h> 15#include <linux/export.h>
14#include <linux/kthread.h> 16#include <linux/kthread.h>
15#include <linux/stop_machine.h> 17#include <linux/stop_machine.h>
@@ -173,6 +175,30 @@ void __ref unregister_cpu_notifier(struct notifier_block *nb)
173} 175}
174EXPORT_SYMBOL(unregister_cpu_notifier); 176EXPORT_SYMBOL(unregister_cpu_notifier);
175 177
178void clear_tasks_mm_cpumask(int cpu)
179{
180 struct task_struct *p;
181
182 /*
183 * This function is called after the cpu is taken down and marked
184 * offline, so its not like new tasks will ever get this cpu set in
185 * their mm mask. -- Peter Zijlstra
186 * Thus, we may use rcu_read_lock() here, instead of grabbing
187 * full-fledged tasklist_lock.
188 */
189 rcu_read_lock();
190 for_each_process(p) {
191 struct task_struct *t;
192
193 t = find_lock_task_mm(p);
194 if (!t)
195 continue;
196 cpumask_clear_cpu(cpu, mm_cpumask(t->mm));
197 task_unlock(t);
198 }
199 rcu_read_unlock();
200}
201
176static inline void check_for_tasks(int cpu) 202static inline void check_for_tasks(int cpu)
177{ 203{
178 struct task_struct *p; 204 struct task_struct *p;