aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index b81ed8703f7..850bde4b31a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4619,8 +4619,10 @@ asmlinkage long sys_sched_yield(void)
static inline int __resched_legal(int expected_preempt_count)
{
+#ifdef CONFIG_PREEMPT
if (unlikely(preempt_count() != expected_preempt_count))
return 0;
+#endif
if (unlikely(system_state != SYSTEM_RUNNING))
return 0;
return 1;