diff --git a/kernel/sched.c b/kernel/sched.c index b81ed8703f70a71a680bd4652cb82818d939662b..850bde4b31a210a38b8443e4e4dc2ba345a04437 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;