sched: avoid stack var in move_task_off_dead_cpu, fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, January 2, 2009 - 2:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1224e3...
Commit:     1224e376f2a7e3c7ab19ef37099a78597978a696
Parent:     3d8cbdf8650f44d95333ca645d950832a0653f35
Author:     Rusty Russell <rusty@rustcorp.com.au>
AuthorDate: Tue Nov 25 09:59:20 2008 +1030
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed Nov 26 07:58:29 2008 +0100

    sched: avoid stack var in move_task_off_dead_cpu, fix
    
    Impact: locking fix
    
    We can't call cpuset_cpus_allowed_locked() with the rq lock held.
    However, the rq lock merely protects us from (1) cpu_online_mask changing
    and (2) someone else changing p->cpus_allowed.
    
    The first can't happen because we're being called from a cpu hotplug
    notifier.  The second doesn't really matter: we are forcing the task off
    a CPU it was affine to, so we're not doing very well anyway.
    
    So we remove the rq lock from this path, and all is good.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Acked-by: Mike Travis <travis@sgi.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 1aa840a..3f5bfdc 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6126,8 +6126,6 @@ static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
  */
 static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
 {
-	unsigned long flags;
-	struct rq *rq;
 	int dest_cpu;
 	/* FIXME: Use cpumask_of_node here. */
 	cpumask_t _nodemask = node_to_cpumask(cpu_to_node(dead_cpu));
@@ -6146,10 +6144,8 @@ again:
 
 	/* No more Mr. Nice Guy. */
 	if (dest_cpu >= nr_cpu_ids) {
-		rq = task_rq_lock(p, &flags);
 		cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
 		dest_cpu = cpumask_any_and(cpu_online_mask, &p->cpus_allowed);
-		task_rq_unlock(rq, &flags);
 
 		/*
 		 * Don't tell them about moving exiting tasks or
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
sched: avoid stack var in move_task_off_dead_cpu, fix, Linux Kernel Mailing ..., (Fri Jan 2, 2:05 pm)