All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Oleg Nesterov <onestero@redhat.com>,
	Nick Piggin <npiggin@suse.de>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [RFC][PATCH]: wait: don't resched in prepare_to_wait()
Date: Fri, 06 Mar 2009 15:39:37 +0100	[thread overview]
Message-ID: <1236350377.6326.389.camel@laptop> (raw)

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);
 



             reply	other threads:[~2009-03-06 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 14:39 Peter Zijlstra [this message]
2009-03-06 15:41 ` [RFC][PATCH]: wait: don't resched in prepare_to_wait() Oleg Nesterov
2009-03-06 15:47   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1236350377.6326.389.camel@laptop \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=onestero@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.