summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-07 11:25:03 +0200
committerClark Williams <williams@redhat.com>2012-02-15 10:32:47 -0600
commitcc5869844e7f739cc249718e1b32143bea277f6c (patch)
tree096dec020b02745a72a484e4e920140451a7e324 /kernel
parentf586b3a229ecc5ca53cc08c08038a5f0b5df0277 (diff)
sched-cond-resched.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index aa3cc029db77..42d00037dde6 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)