[tip: locking/core] sched: Remove the unused preempt_offset parameter of __cant_sleep()
From: tip-bot2 for Boqun Feng
Date: Mon Aug 10 2026 - 04:59:16 EST
The following commit has been merged into the locking/core branch of tip:
Commit-ID: ac4231a77973fc20808ed84c4af343eca2342d4b
Gitweb: https://git.kernel.org/tip/ac4231a77973fc20808ed84c4af343eca2342d4b
Author: Boqun Feng <boqun@xxxxxxxxxx>
AuthorDate: Tue, 04 Aug 2026 09:14:30 -07:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 10 Aug 2026 10:50:19 +02:00
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@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260804161447.84806-9-boqun@xxxxxxxxxx
---
include/linux/kernel.h | 4 ++--
kernel/sched/core.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e5570a1..24414c7 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -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)
/**
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9622670..aa116da 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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)