sched: Remove the unused preempt_offset parameter of __cant_sleep()

The preempt_offset is always 0 in all the callsites of __cant_sleep(),
hence remove it. It also allows us to clear up the code a bit by
no longer using a "preempt_count() > .." comparison.

Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260804161447.84806-9-boqun@kernel.org
This commit is contained in:
Boqun Feng
2026-08-04 09:14:30 -07:00
committed by Peter Zijlstra
parent 1b08668748
commit ac4231a779
2 changed files with 4 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ extern int dynamic_might_resched(void);
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
extern void __might_resched(const char *file, int line, unsigned int offsets);
extern void __might_sleep(const char *file, int line);
extern void __cant_sleep(const char *file, int line, int preempt_offset);
extern void __cant_sleep(const char *file, int line);
extern void __cant_migrate(const char *file, int line);
/**
@@ -95,7 +95,7 @@ extern void __cant_migrate(const char *file, int line);
* this macro will print a stack trace if it is executed with preemption enabled
*/
# define cant_sleep() \
do { __cant_sleep(__FILE__, __LINE__, 0); } while (0)
do { __cant_sleep(__FILE__, __LINE__); } while (0)
# define sched_annotate_sleep() (current->task_state_change = 0)
/**

View File

@@ -9199,7 +9199,7 @@ void __might_resched(const char *file, int line, unsigned int offsets)
}
EXPORT_SYMBOL(__might_resched);
void __cant_sleep(const char *file, int line, int preempt_offset)
void __cant_sleep(const char *file, int line)
{
static unsigned long prev_jiffy;
@@ -9209,7 +9209,7 @@ void __cant_sleep(const char *file, int line, int preempt_offset)
if (!IS_ENABLED(CONFIG_PREEMPT_COUNT))
return;
if (preempt_count() > preempt_offset)
if (preempt_count())
return;
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)