39 lines
955 B
Diff
39 lines
955 B
Diff
From 74dde8bd22fa29f1dc21a3e2a6ed93fdbda04374 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Tue, 7 Jun 2011 11:25:03 +0200
|
|
Subject: [PATCH 148/267] sched-cond-resched.patch
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
---
|
|
kernel/sched.c | 14 +++++++++++---
|
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/kernel/sched.c b/kernel/sched.c
|
|
index aa3cc02..42d0003 100644
|
|
--- a/kernel/sched.c
|
|
+++ b/kernel/sched.c
|
|
@@ -5775,9 +5775,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)
|
|
--
|
|
1.7.10
|
|
|