summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorBoqun Feng <boqun@kernel.org>2026-08-04 09:14:29 -0700
committerPeter Zijlstra <peterz@infradead.org>2026-08-10 10:50:18 +0200
commit1b086687483371621e684e2a05b2bcd2cf07b634 (patch)
tree70eb822ff3826d9d12a528f036bc856f6523b553 /kernel
parent07a88e2bcd5b5bd7881b2e12b6aad1897a7ee1de (diff)
locking: Switch to _irq_{disable,enable}() variants in cleanup guards
The semantics of various IRQ disabling guards match what *_irq_{disable,enable}() provide, i.e. the interrupt disabling is properly nested, therefore it's OK to switch to use *_irq_{disable,enable}() primitives. [boqun: Adjust the user-side changes in do_sched_cfs_*_timer() provided by Peter and Lyude] Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260804161447.84806-8-boqun@kernel.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d78467ec6ee1..a46c4ff49f74 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7120,7 +7120,7 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b)
* period the timer is deactivated until scheduling resumes; cfs_b->idle is
* used to track this state.
*/
-static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun, unsigned long flags)
+static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
__must_hold(&cfs_b->lock)
{
int throttled;
@@ -7155,10 +7155,10 @@ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun, u
* This check is repeated as we release cfs_b->lock while we unthrottle.
*/
while (throttled && cfs_b->runtime > 0) {
- raw_spin_unlock_irqrestore(&cfs_b->lock, flags);
+ raw_spin_unlock_irq_enable(&cfs_b->lock);
/* we can't nest cfs_b->lock while distributing bandwidth */
throttled = distribute_cfs_runtime(cfs_b);
- raw_spin_lock_irqsave(&cfs_b->lock, flags);
+ raw_spin_lock_irq_disable(&cfs_b->lock);
}
/*
@@ -7266,7 +7266,7 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq)
static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b)
{
/* confirm we're still not at a refresh boundary */
- scoped_guard(raw_spinlock_irqsave, &cfs_b->lock) {
+ scoped_guard(raw_spinlock_irq, &cfs_b->lock) {
u64 runtime = 0, slice = sched_cfs_bandwidth_slice();
cfs_b->slack_started = false;
@@ -7351,14 +7351,14 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)
int idle = 0;
int count = 0;
- CLASS(raw_spinlock_irqsave, cfsb_guard)(&cfs_b->lock);
+ guard(raw_spinlock_irq)(&cfs_b->lock);
for (;;) {
overrun = hrtimer_forward_now(timer, cfs_b->period);
if (!overrun)
break;
- idle = do_sched_cfs_period_timer(cfs_b, overrun, cfsb_guard.flags);
+ idle = do_sched_cfs_period_timer(cfs_b, overrun);
if (++count > 3) {
u64 new, old = ktime_to_ns(cfs_b->period);