diff options
-rw-r--r-- | kernel/sched.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 5f2182d42241..4107db0dc091 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3877,6 +3877,13 @@ asmlinkage long sys_sched_yield(void) | |||
3877 | 3877 | ||
3878 | static inline void __cond_resched(void) | 3878 | static inline void __cond_resched(void) |
3879 | { | 3879 | { |
3880 | /* | ||
3881 | * The BKS might be reacquired before we have dropped | ||
3882 | * PREEMPT_ACTIVE, which could trigger a second | ||
3883 | * cond_resched() call. | ||
3884 | */ | ||
3885 | if (unlikely(preempt_count())) | ||
3886 | return; | ||
3880 | do { | 3887 | do { |
3881 | add_preempt_count(PREEMPT_ACTIVE); | 3888 | add_preempt_count(PREEMPT_ACTIVE); |
3882 | schedule(); | 3889 | schedule(); |