diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-06-07 11:25:03 +0200 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2011-11-14 11:01:51 -0600 |
commit | bfe5c635639f709eaf4886527132b00e2b0f79e9 (patch) | |
tree | 2a329efe5f896d662c5419d7ca4b28ad4d966ce5 | |
parent | c2a8730f35b8a749c82ae808cc27a7c1005bff22 (diff) |
sched-cond-resched.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0469d5d42369..b91e672f755e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -5762,9 +5762,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) |