Skip to content

Commit

Permalink
sched: fix possible recursive rq->lock
Browse files Browse the repository at this point in the history
Vaidyanathan Srinivasan reported:

 > =============================================
 > [ INFO: possible recursive locking detected ]
 > 2.6.28-autotest-tip-sv #1
 > ---------------------------------------------
 > klogd/5062 is trying to acquire lock:
 >  (&rq->lock){++..}, at: [<ffffffff8022aca2>] task_rq_lock+0x45/0x7e
 >
 > but task is already holding lock:
 >  (&rq->lock){++..}, at: [<ffffffff805f7354>] schedule+0x158/0xa31

With sched_mc at 2. (it is default-off)

Strictly speaking we'll not deadlock, because ttwu will not be able to
place the migration task on our rq, but since the code can deal with
both rqs getting unlocked, this seems the easiest way out.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jan 7, 2009
1 parent ede6f5a commit da8d508
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3728,8 +3728,13 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd,
}

double_unlock_balance(this_rq, busiest);
/*
* Should not call ttwu while holding a rq->lock
*/
spin_unlock(&this_rq->lock);
if (active_balance)
wake_up_process(busiest->migration_thread);
spin_lock(&this_rq->lock);

} else
sd->nr_balance_failed = 0;
Expand Down

0 comments on commit da8d508

Please sign in to comment.