Commit 5bbcfd90 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] cond_resched(): fix bogus might_sleep() warning

The BKS might be reacquired before we have dropped PREEMPT_ACTIVE, which
could trigger a second could trigger a second cond_resched() call.  Bug
found by Hirofumi Ogawa.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a4014d8f
...@@ -3877,6 +3877,13 @@ asmlinkage long sys_sched_yield(void) ...@@ -3877,6 +3877,13 @@ asmlinkage long sys_sched_yield(void)
static inline void __cond_resched(void) static inline void __cond_resched(void)
{ {
/*
* The BKS might be reacquired before we have dropped
* PREEMPT_ACTIVE, which could trigger a second
* cond_resched() call.
*/
if (unlikely(preempt_count()))
return;
do { do {
add_preempt_count(PREEMPT_ACTIVE); add_preempt_count(PREEMPT_ACTIVE);
schedule(); schedule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment