Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309745
b: refs/heads/master
c: cb79295
h: refs/heads/master
i:
  309743: 70e36d3
v: v3
  • Loading branch information
Anton Vorontsov authored and Linus Torvalds committed Jun 1, 2012
1 parent c0545f9 commit 36650c9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f7505d64f2db5da2d7d94873ddf2cd2524847061
refs/heads/master: cb79295e20a8088a2fd6a9b3cb5f2d889ec36b4d
1 change: 1 addition & 0 deletions trunk/include/linux/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions trunk/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/cpu.h>
#include <linux/oom.h>
#include <linux/rcupdate.h>
#include <linux/export.h>
#include <linux/kthread.h>
#include <linux/stop_machine.h>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 36650c9

Please sign in to comment.