[RFC][PATCH]: wait: don't resched in prepare_to_wait()

From: Peter Zijlstra
Date: Fri Mar 06 2009 - 09:40:16 EST


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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/