35 lines
932 B
Diff
35 lines
932 B
Diff
Subject: sched-cond-resched.patch
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Tue, 07 Jun 2011 11:25:03 +0200
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
---
|
|
kernel/sched/core.c | 14 +++++++++++---
|
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
Index: linux-stable/kernel/sched/core.c
|
|
===================================================================
|
|
--- linux-stable.orig/kernel/sched/core.c
|
|
+++ linux-stable/kernel/sched/core.c
|
|
@@ -4781,9 +4781,17 @@ static inline int should_resched(void)
|
|
|
|
static void __cond_resched(void)
|
|
{
|
|
- add_preempt_count(PREEMPT_ACTIVE);
|
|
- __schedule();
|
|
- sub_preempt_count(PREEMPT_ACTIVE);
|
|
+ do {
|
|
+ add_preempt_count(PREEMPT_ACTIVE);
|
|
+ __schedule();
|
|
+ sub_preempt_count(PREEMPT_ACTIVE);
|
|
+ /*
|
|
+ * Check again in case we missed a preemption
|
|
+ * opportunity between schedule and now.
|
|
+ */
|
|
+ barrier();
|
|
+
|
|
+ } while (need_resched());
|
|
}
|
|
|
|
int __sched _cond_resched(void)
|