mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpufreq: schedutil: Skip busy-CPU hold when NOHZ is disabled
@ 2026-11-03  6:15 Avi Weiss
  2026-11-03  7:17 ` Zhan Xusheng
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Weiss @ 2026-11-03  6:15 UTC (permalink / raw)
  To: rafael, viresh.kumar; +Cc: linux-pm, linux-kernel, Avi Weiss

With nohz=off, tick_nohz_idle_stop_tick() can return without
incrementing idle_calls. sugov_hold_freq() then treats an unchanged
counter as continuous CPU activity and can prevent frequency reductions
even after the CPU has been idle.

Skip the busy-CPU hold heuristic when NOHZ is disabled.

Fixes: b7eaf1aab9f8 ("cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/sched/cpufreq_schedutil.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 14405a614991..111582876954 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -397,6 +397,9 @@ static bool sugov_hold_freq(struct sugov_cpu *sg_cpu)
 	if (uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)))
 		return false;
 
+	if (!tick_nohz_enabled)
+		return false;
+
 	/*
 	 * Maintain the frequency if the CPU has not been idle recently, as
 	 * reduction is likely to be premature.

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: schedutil: Skip busy-CPU hold when NOHZ is disabled
  2026-11-03  6:15 [PATCH] cpufreq: schedutil: Skip busy-CPU hold when NOHZ is disabled Avi Weiss
@ 2026-11-03  7:17 ` Zhan Xusheng
  2026-11-03 11:03   ` Zhongqiu Han
  0 siblings, 1 reply; 3+ messages in thread
From: Zhan Xusheng @ 2026-11-03  7:17 UTC (permalink / raw)
  To: thnkslprpt; +Cc: rafael, viresh.kumar, linux-pm, linux-kernel, zhanxusheng

Hi Avi,

On Tue, Nov 03, 2026 at 08:15:57AM +0200, Avi Weiss wrote:
> +	if (!tick_nohz_enabled)
> +		return false;

idle_calls also never moves when nohz is enabled but was never
activated, because tick_check_oneshot_change() found no oneshot clock
event device or no clocksource valid for high resolution. TS_FLAG_NOHZ
then stays clear, as with nohz=off. tick_nohz_is_active() covers both:

	if (!tick_nohz_is_active())
		return false;

Thanks,
Zhan Xusheng

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: schedutil: Skip busy-CPU hold when NOHZ is disabled
  2026-11-03  7:17 ` Zhan Xusheng
@ 2026-11-03 11:03   ` Zhongqiu Han
  0 siblings, 0 replies; 3+ messages in thread
From: Zhongqiu Han @ 2026-11-03 11:03 UTC (permalink / raw)
  To: Zhan Xusheng, thnkslprpt
  Cc: rafael, viresh.kumar, linux-pm, linux-kernel, zhanxusheng, zhongqiu.han

On 11/3/2026 3:17 PM, Zhan Xusheng wrote:
> Hi Avi,
> 
> On Tue, Nov 03, 2026 at 08:15:57AM +0200, Avi Weiss wrote:
>> +	if (!tick_nohz_enabled)
>> +		return false;
> 
> idle_calls also never moves when nohz is enabled but was never
> activated, because tick_check_oneshot_change() found no oneshot clock
> event device or no clocksource valid for high resolution. TS_FLAG_NOHZ
> then stays clear, as with nohz=off. tick_nohz_is_active() covers both:
> 
> 	if (!tick_nohz_is_active())
> 		return false;

Agree with Xusheng, tick_nohz_is_active() is one more reasonable check,
it also covers NOHZ never getting activated. Besides please Cc: stable,
and Cc the scheduler maintainers (scripts/get_maintainer.pl).

Note that this still leaves the nohz_full timekeeping CPU and idle=poll,
where NOHZ is active but idle_calls never moves either. That's a deeper
issue with using a tick-stop counter as an "idle recently" signal and
it may be addressed separately.

> 
> Thanks,
> Zhan Xusheng
> 


-- 
Thx and BRs,
Zhongqiu Han

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  6:15 [PATCH] cpufreq: schedutil: Skip busy-CPU hold when NOHZ is disabled Avi Weiss
2026-11-03  7:17 ` Zhan Xusheng
2026-11-03 11:03   ` Zhongqiu Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®