mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
sched: Avoid signed comparison of preempt_count() in __cant_migrate()
Currently preempt_count() is always a non-negative int on all archs (PREEMPT_NEED_RESCHED archs will mask out the MSB when returning preempt_count()), hence the checking in __cant_migrate() is in fact just checking whether preempt_count() is 0 or not. In a future change, we are going to use all the 32 bits of preempt_count(), which would make negative int values possible from preempt_count(). Therefore convert the "> 0" comparison into a zero check to prepare for the future change. No functional changes are intended. Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260804161447.84806-10-boqun@kernel.org
This commit is contained in:
committed by
Peter Zijlstra
parent
ac4231a779
commit
560fcaa92e
@@ -9241,7 +9241,7 @@ void __cant_migrate(const char *file, int line)
|
||||
if (!IS_ENABLED(CONFIG_PREEMPT_COUNT))
|
||||
return;
|
||||
|
||||
if (preempt_count() > 0)
|
||||
if (preempt_count())
|
||||
return;
|
||||
|
||||
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
|
||||
|
||||
Reference in New Issue
Block a user