public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH]: wait: don't resched in prepare_to_wait()
@ 2009-03-06 14:39 Peter Zijlstra
  2009-03-06 15:41 ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2009-03-06 14:39 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Oleg Nesterov, Nick Piggin; +Cc: lkml

Does the below make sense?

After prepare to wait, we either call schedule() or find !cond in which
case we'll call finish_wait() which contains another preemption check.

Not-signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/wait.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/wait.c b/kernel/wait.c
index 42a2dbc..7b866ab 100644
--- a/kernel/wait.c
+++ b/kernel/wait.c
@@ -73,7 +73,9 @@ prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
 	if (list_empty(&wait->task_list))
 		__add_wait_queue(q, wait);
 	set_current_state(state);
+	preempt_disable();
 	spin_unlock_irqrestore(&q->lock, flags);
+	preempt_enable_no_resched();
 }
 EXPORT_SYMBOL(prepare_to_wait);
 
@@ -87,7 +89,9 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
 	if (list_empty(&wait->task_list))
 		__add_wait_queue_tail(q, wait);
 	set_current_state(state);
+	preempt_disable();
 	spin_unlock_irqrestore(&q->lock, flags);
+	preempt_enable_no_resched();
 }
 EXPORT_SYMBOL(prepare_to_wait_exclusive);
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-06 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06 14:39 [RFC][PATCH]: wait: don't resched in prepare_to_wait() Peter Zijlstra
2009-03-06 15:41 ` Oleg Nesterov
2009-03-06 15:47   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox