Skip to contentSkip to conversation

scheduler fix

GIT PULL Ingo Molnar 3 participants 3 messages Jan 7, 2009 – Jan 8, 2009

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest sched-fixes-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git sched-fixes-for-linus

Thanks,

Ingo

------------------>
Peter Zijlstra (1):

      sched: fix possible recursive rq->lock
 kernel/sched.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
kernel/sched.c +5 -0
index 2e3545f..deb5ac8 100644
@@ -3728,8 +3728,13 @@ redo:
 		}
 
 		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;
#1 lore raw

kernel/sched.c redo: · line 3737

Quoted 7 lines · Ingo Molnar
kernel/sched.c +5 -0
+		/*
+		 * 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);

Btw, this isn't the first time we've wanted to do a wakeup while potentially locked.

Is there any way to perhaps go a "wake_up_gentle()" that doesn't need the lock, and just basically does a potentially delayed wakeup by just scheduling it asynchronously.

That would have solved all those nasty printk issues too. These kinds of things don't need the strict "wake up NOW" behaviour - they are more of a "kick the dang thing and make sure it wakes up in some timely manner".

Linus

#2 lore raw
Quoted 13 lines · Linus Torvalds

kernel/sched.c redo: · line 3737

Quoted 7 lines · Ingo Molnar
kernel/sched.c +5 -0
+		/*
+		 * 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);

Btw, this isn't the first time we've wanted to do a wakeup while potentially locked.

Quoted 7 lines

Is there any way to perhaps go a "wake_up_gentle()" that doesn't need the lock, and just basically does a potentially delayed wakeup by just scheduling it asynchronously.

That would have solved all those nasty printk issues too. These kinds of things don't need the strict "wake up NOW" behaviour - they are more of a "kick the dang thing and make sure it wakes up in some timely manner".

Right -- so the printk thing was solved by polling some state from the timer tick, we could make that into a list, but then you'd have to worry about memory allocation for list elements failing etc.

Same story as generic smp function call, we could do this using a self (or remote) IPI, but you'd still have the memory allocation issue -- and would need to make self-IPI work on !SMP.

I'll ponder the issue a bit more, but I'm not directly seeing anything (of course, if it were easy, we'd have done it ages ago ;-)