Re: [PATCH] cpufreq: schedutil: Run irq_work in hardirq context on PREEMPT_RT

From: sashiko-bot

Date: Wed Nov 25 2026 - 03:13:15 EST


Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] sched/deadline: unallocated bandwidth subtraction in
dl_task_needs_bw_move() [1]
--

commit 6dbfa989b510ecc8b3f76fbbc75d3d06fb5180f2
Author: Zhongqiu Han <zhongqiu.han@xxxxxxxxxxxxxxxx>

cpufreq: schedutil: Run irq_work in hardirq context on PREEMPT_RT

This commit initializes sg_policy->irq_work with IRQ_WORK_INIT_HARD() so
that sugov_irq_work() runs in hardirq context on PREEMPT_RT instead of
being delayed behind runnable RT tasks.

> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 14405a6149911..b2e9ac7e35172 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -726,7 +726,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
> else
> kthread_bind_mask(thread, policy->related_cpus);
>
> - init_irq_work(&sg_policy->irq_work, sugov_irq_work);
> + sg_policy->irq_work = IRQ_WORK_INIT_HARD(sugov_irq_work);
> mutex_init(&sg_policy->work_lock);
>
> wake_up_process(thread);

[Severity: High]
This problem wasn't introduced by this patch, but can binding the sugov
thread across exclusive cpuset partitions (root domains) here underflow
the source root domain's deadline bandwidth [1]?

sched_setattr_nocheck() configures the sugov thread with SCHED_DEADLINE
and SCHED_FLAG_SUGOV, which sets a non-zero p->dl.dl_bw while skipping
root domain bandwidth allocation because dl_entity_is_special(&p->dl) is
true. If policy->related_cpus lies in a different root domain from the
kthread's initial CPU mask, set_cpus_allowed_ptr() or kthread_bind_mask()
calls set_cpus_allowed_dl(), which subtracts p->dl.dl_bw from the source
root domain whenever dl_task_needs_bw_move() returns true.

Unlike dl_add_task_root_domain() and dl_task_check_affinity(),
dl_task_needs_bw_move() does not exclude dl_entity_is_special(&p->dl)
tasks, so __dl_sub() subtracts bandwidth that was never added, triggering
a warning in __dl_sub() and corrupting SCHED_DEADLINE admission control
on the source root domain.

[1] https://sashiko.dev/#/bug/linux-a604bbac-776b-419e-820b-f5a41a07ff1c

--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125080613.1138573-1-zhongqiu.han@xxxxxxxxxxxxxxxx?part=1