mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpufreq: schedutil: Allow use on UP kernels
@ 2026-11-29 20:10 Christian Loehle
  2026-11-30  3:46 ` K Prateek Nayak
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Christian Loehle @ 2026-11-29 20:10 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, mehmet.fide, linux-kernel,
	Christian Loehle

Schedutil was restricted to SMP when the scheduler did not provide
utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
restrictions remained.

Allow UP kernels to build and select schedutil, including as their
default governor. Keep the existing performance default for ARM UP by
selecting schedutil automatically only on SMP.

Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
 drivers/cpufreq/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index edc1299098d4..da6dd2acb3ce 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -37,7 +37,7 @@ config CPU_FREQ_STAT
 choice
 	prompt "Default CPUFreq governor"
 	default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1110_CPUFREQ
-	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if ARM64 || ARM
+	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (ARM64 || ARM) && SMP
 	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (X86_INTEL_PSTATE || X86_AMD_PSTATE) && SMP
 	default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
 	help
@@ -97,7 +97,6 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
 
 config CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
 	bool "schedutil"
-	depends on SMP
 	select CPU_FREQ_GOV_SCHEDUTIL
 	select CPU_FREQ_GOV_PERFORMANCE
 	help
@@ -187,7 +186,6 @@ config CPU_FREQ_GOV_CONSERVATIVE
 
 config CPU_FREQ_GOV_SCHEDUTIL
 	bool "'schedutil' cpufreq policy governor"
-	depends on SMP
 	select CPU_FREQ_GOV_ATTR_SET
 	select IRQ_WORK
 	help
-- 
2.34.1


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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-11-29 20:10 [PATCH] cpufreq: schedutil: Allow use on UP kernels Christian Loehle
@ 2026-11-30  3:46 ` K Prateek Nayak
  2026-11-30 13:36 ` Vincent Guittot
  2026-11-30 13:44 ` Zhongqiu Han
  2 siblings, 0 replies; 8+ messages in thread
From: K Prateek Nayak @ 2026-11-30  3:46 UTC (permalink / raw)
  To: Christian Loehle, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, mehmet.fide, linux-kernel

Hello Chris,

On 11/30/2026 1:40 AM, Christian Loehle wrote:
> Schedutil was restricted to SMP when the scheduler did not provide
> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
> restrictions remained.
> 
> Allow UP kernels to build and select schedutil, including as their
> default governor. Keep the existing performance default for ARM UP by
> selecting schedutil automatically only on SMP.
> 
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>

I can see schedutil running with all its glory on my UP server :-)
Feel free to include:

Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>

> ---
>  drivers/cpufreq/Kconfig | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> index edc1299098d4..da6dd2acb3ce 100644
> --- a/drivers/cpufreq/Kconfig
> +++ b/drivers/cpufreq/Kconfig
> @@ -37,7 +37,7 @@ config CPU_FREQ_STAT
>  choice
>  	prompt "Default CPUFreq governor"
>  	default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1110_CPUFREQ
> -	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if ARM64 || ARM
> +	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (ARM64 || ARM) && SMP
>  	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (X86_INTEL_PSTATE || X86_AMD_PSTATE) && SMP
>  	default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
>  	help
> @@ -97,7 +97,6 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
>  
>  config CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
>  	bool "schedutil"
> -	depends on SMP
>  	select CPU_FREQ_GOV_SCHEDUTIL
>  	select CPU_FREQ_GOV_PERFORMANCE
>  	help
> @@ -187,7 +186,6 @@ config CPU_FREQ_GOV_CONSERVATIVE
>  
>  config CPU_FREQ_GOV_SCHEDUTIL
>  	bool "'schedutil' cpufreq policy governor"
> -	depends on SMP
>  	select CPU_FREQ_GOV_ATTR_SET
>  	select IRQ_WORK
>  	help

-- 
Thanks and Regards,
Prateek


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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-11-29 20:10 [PATCH] cpufreq: schedutil: Allow use on UP kernels Christian Loehle
  2026-11-30  3:46 ` K Prateek Nayak
@ 2026-11-30 13:36 ` Vincent Guittot
  2026-11-30 13:44 ` Zhongqiu Han
  2 siblings, 0 replies; 8+ messages in thread
From: Vincent Guittot @ 2026-11-30 13:36 UTC (permalink / raw)
  To: Christian Loehle
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, mehmet.fide, linux-kernel, Rafael J. Wysocki,
	Viresh Kumar, open list:THERMAL

CCing Rafael and Viresh who maintain this ;-)

On Sun, 29 Nov 2026 at 21:11, Christian Loehle <christian.loehle@arm.com> wrote:
>
> Schedutil was restricted to SMP when the scheduler did not provide
> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
> restrictions remained.
>
> Allow UP kernels to build and select schedutil, including as their
> default governor. Keep the existing performance default for ARM UP by
> selecting schedutil automatically only on SMP.
>
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>

Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  drivers/cpufreq/Kconfig | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> index edc1299098d4..da6dd2acb3ce 100644
> --- a/drivers/cpufreq/Kconfig
> +++ b/drivers/cpufreq/Kconfig
> @@ -37,7 +37,7 @@ config CPU_FREQ_STAT
>  choice
>         prompt "Default CPUFreq governor"
>         default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1110_CPUFREQ
> -       default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if ARM64 || ARM
> +       default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (ARM64 || ARM) && SMP
>         default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (X86_INTEL_PSTATE || X86_AMD_PSTATE) && SMP
>         default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
>         help
> @@ -97,7 +97,6 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
>
>  config CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
>         bool "schedutil"
> -       depends on SMP
>         select CPU_FREQ_GOV_SCHEDUTIL
>         select CPU_FREQ_GOV_PERFORMANCE
>         help
> @@ -187,7 +186,6 @@ config CPU_FREQ_GOV_CONSERVATIVE
>
>  config CPU_FREQ_GOV_SCHEDUTIL
>         bool "'schedutil' cpufreq policy governor"
> -       depends on SMP
>         select CPU_FREQ_GOV_ATTR_SET
>         select IRQ_WORK
>         help
> --
> 2.34.1
>

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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-11-29 20:10 [PATCH] cpufreq: schedutil: Allow use on UP kernels Christian Loehle
  2026-11-30  3:46 ` K Prateek Nayak
  2026-11-30 13:36 ` Vincent Guittot
@ 2026-11-30 13:44 ` Zhongqiu Han
  2026-12-01  3:48   ` K Prateek Nayak
  2 siblings, 1 reply; 8+ messages in thread
From: Zhongqiu Han @ 2026-11-30 13:44 UTC (permalink / raw)
  To: Christian Loehle, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, mehmet.fide, linux-kernel,
	Zhongqiu Han, Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY SCALING FRAMEWORK

Hi Christian,

Thanks for the patch.

On 11/30/2026 4:10 AM, Christian Loehle wrote:
> Schedutil was restricted to SMP when the scheduler did not provide
> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
> restrictions remained.

[Adding Rafael, Viresh and linux-pm]

The Kconfig change looks fine, but one thing may be worth discussing:
on a single CPU rq->sd is NULL, so the blocked load update never runs
and rq->avg_rt/avg_dl don't decay until another RT/DL task runs.
Couldn't that leave the frequency stuck high? Should NULL-domain CPUs
decay these from the tick, like scx_tick() does?

> 
> Allow UP kernels to build and select schedutil, including as their
> default governor. Keep the existing performance default for ARM UP by
> selecting schedutil automatically only on SMP.
> 
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> ---
>   drivers/cpufreq/Kconfig | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> index edc1299098d4..da6dd2acb3ce 100644
> --- a/drivers/cpufreq/Kconfig
> +++ b/drivers/cpufreq/Kconfig
> @@ -37,7 +37,7 @@ config CPU_FREQ_STAT
>   choice
>   	prompt "Default CPUFreq governor"
>   	default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1110_CPUFREQ
> -	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if ARM64 || ARM
> +	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (ARM64 || ARM) && SMP
>   	default CPU_FREQ_DEFAULT_GOV_SCHEDUTIL if (X86_INTEL_PSTATE || X86_AMD_PSTATE) && SMP
>   	default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
>   	help
> @@ -97,7 +97,6 @@ config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
>   
>   config CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
>   	bool "schedutil"
> -	depends on SMP
>   	select CPU_FREQ_GOV_SCHEDUTIL
>   	select CPU_FREQ_GOV_PERFORMANCE
>   	help
> @@ -187,7 +186,6 @@ config CPU_FREQ_GOV_CONSERVATIVE
>   
>   config CPU_FREQ_GOV_SCHEDUTIL
>   	bool "'schedutil' cpufreq policy governor"
> -	depends on SMP
>   	select CPU_FREQ_GOV_ATTR_SET
>   	select IRQ_WORK
>   	help


-- 
Thx and BRs,
Zhongqiu Han

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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-11-30 13:44 ` Zhongqiu Han
@ 2026-12-01  3:48   ` K Prateek Nayak
  2026-12-01  7:16     ` Vincent Guittot
  0 siblings, 1 reply; 8+ messages in thread
From: K Prateek Nayak @ 2026-12-01  3:48 UTC (permalink / raw)
  To: Zhongqiu Han, Christian Loehle, Ingo Molnar, Peter Zijlstra,
	Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, mehmet.fide, linux-kernel, Rafael J. Wysocki,
	Viresh Kumar, open list:CPU FREQUENCY SCALING FRAMEWORK

Hello Zhongqiu,

On 11/30/2026 7:14 PM, Zhongqiu Han wrote:
> Hi Christian,
> 
> Thanks for the patch.
> 
> On 11/30/2026 4:10 AM, Christian Loehle wrote:
>> Schedutil was restricted to SMP when the scheduler did not provide
>> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
>> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
>> restrictions remained.
> 
> [Adding Rafael, Viresh and linux-pm]
> 
> The Kconfig change looks fine, but one thing may be worth discussing:
> on a single CPU rq->sd is NULL, so the blocked load update never runs
> and rq->avg_rt/avg_dl don't decay until another RT/DL task runs.
> Couldn't that leave the frequency stuck high? Should NULL-domain CPUs
> decay these from the tick, like scx_tick() does?

Yes, it does make sense to update the averages if we get a tick on a
NULL domain CPU - isolated ones should not get a tick and the remote
handlers should do the right thing for the regular nohz ones.

Something like below perhaps:

  (Only build tested)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2d9d3d686261..16fffd6381e5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10386,6 +10386,15 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct t
 	struct cfs_rq *cfs_rq = &rq->cfs;
 	struct sched_entity *nse = NULL;
 
+	/*
+	 * Task from a different class will run next - if it is a higher
+	 * priority class, we'll need to decau its averages next or if
+	 * it is a lower priority class, blocked averages for fair needs
+	 * decaying. Notify there may be some blocked load to decay.
+	 */
+	if (next && next->sched_class != &fair_sched_class)
+		rq->has_blocked_load = 1;
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	if (next && next->sched_class == &fair_sched_class)
 		nse = &next->se;
@@ -11548,18 +11557,18 @@ static inline void update_blocked_load_tick(struct rq *rq)
 	WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies);
 }
 
-static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
-{
-	if (!has_blocked_load)
-		rq->has_blocked_load = 0;
-}
 #else /* !CONFIG_NO_HZ_COMMON: */
 static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) { return false; }
 static inline bool others_have_blocked(struct rq *rq) { return false; }
 static inline void update_blocked_load_tick(struct rq *rq) {}
-static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) {}
 #endif /* !CONFIG_NO_HZ_COMMON */
 
+static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
+{
+	if (!has_blocked_load)
+		rq->has_blocked_load = 0;
+}
+
 static bool __update_blocked_others(struct rq *rq, bool *done)
 {
 	bool updated;
@@ -15073,8 +15082,11 @@ void sched_balance_trigger(struct rq *rq)
 	 * Don't need to rebalance while attached to NULL domain or
 	 * runqueue CPU is not active
 	 */
-	if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq))))
+	if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq)))) {
+		if (rq->has_blocked_load)
+			sched_balance_update_blocked_averages(cpu_of(rq));
 		return;
+	}
 
 	if (time_after_eq(jiffies, rq->next_balance))
 		raise_softirq(SCHED_SOFTIRQ);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 32f76551a0c5..dc2ead0b06cc 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1235,7 +1235,6 @@ struct rq {
 #ifdef CONFIG_NO_HZ_COMMON
 	unsigned int		nohz_tick_stopped;
 	atomic_t		nohz_flags;
-	unsigned int		has_blocked_load;
 	unsigned long		last_blocked_load_update_tick;
 	call_single_data_t	nohz_csd;
 #endif /* CONFIG_NO_HZ_COMMON */
@@ -1337,6 +1336,7 @@ struct rq {
 
 	struct list_head cfs_tasks;
 
+	unsigned int		has_blocked_load;
 	struct sched_avg	avg_rt;
 	struct sched_avg	avg_dl;
 #ifdef CONFIG_HAVE_SCHED_AVG_IRQ
---

I think the setting rq->has_blocked_load in put_prev_task_fair() is safe
for SMP too since this is only checked from nohz handler for the
nohz_idle_cpus - nohz CPU would have populate this anyway when going
idle from nohz_balance_enter_idle().

If the load was decayed fully and a short running task (short enough to
not accumulate any PELT segments) runs, the rq->has_blocked_load
indicator would be set spuriously and get corrected soon at next nohz
balance trigger. On null domain CPUs, only the tick care about it.

Thoughts?

-- 
Thanks and Regards,
Prateek


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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-12-01  3:48   ` K Prateek Nayak
@ 2026-12-01  7:16     ` Vincent Guittot
  2026-12-01  7:36       ` Vincent Guittot
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Guittot @ 2026-12-01  7:16 UTC (permalink / raw)
  To: K Prateek Nayak
  Cc: Zhongqiu Han, Christian Loehle, Ingo Molnar, Peter Zijlstra,
	Juri Lelli, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Valentin Schneider, mehmet.fide, linux-kernel,
	Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY SCALING FRAMEWORK

On Tue, 1 Dec 2026 at 04:49, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
>
> Hello Zhongqiu,
>
> On 11/30/2026 7:14 PM, Zhongqiu Han wrote:
> > Hi Christian,
> >
> > Thanks for the patch.
> >
> > On 11/30/2026 4:10 AM, Christian Loehle wrote:
> >> Schedutil was restricted to SMP when the scheduler did not provide
> >> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
> >> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
> >> restrictions remained.
> >
> > [Adding Rafael, Viresh and linux-pm]
> >
> > The Kconfig change looks fine, but one thing may be worth discussing:
> > on a single CPU rq->sd is NULL, so the blocked load update never runs
> > and rq->avg_rt/avg_dl don't decay until another RT/DL task runs.
> > Couldn't that leave the frequency stuck high? Should NULL-domain CPUs
> > decay these from the tick, like scx_tick() does?
>
> Yes, it does make sense to update the averages if we get a tick on a
> NULL domain CPU - isolated ones should not get a tick and the remote
> handlers should do the right thing for the regular nohz ones.
>
> Something like below perhaps:

Instead of spreading this here and there, we should better reuse what
is already available, i.e.: update blocked load during the periodic
tick and when entering idle.
we have sched_balance_trigger and sched_balance_newidle which return
early in UP case, we need to make sure that they will update blocked
load in case of UP

>
>   (Only build tested)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2d9d3d686261..16fffd6381e5 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10386,6 +10386,15 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct t
>         struct cfs_rq *cfs_rq = &rq->cfs;
>         struct sched_entity *nse = NULL;
>
> +       /*
> +        * Task from a different class will run next - if it is a higher
> +        * priority class, we'll need to decau its averages next or if
> +        * it is a lower priority class, blocked averages for fair needs
> +        * decaying. Notify there may be some blocked load to decay.
> +        */
> +       if (next && next->sched_class != &fair_sched_class)
> +               rq->has_blocked_load = 1;
> +
>  #ifdef CONFIG_FAIR_GROUP_SCHED
>         if (next && next->sched_class == &fair_sched_class)
>                 nse = &next->se;
> @@ -11548,18 +11557,18 @@ static inline void update_blocked_load_tick(struct rq *rq)
>         WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies);
>  }
>
> -static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
> -{
> -       if (!has_blocked_load)
> -               rq->has_blocked_load = 0;
> -}
>  #else /* !CONFIG_NO_HZ_COMMON: */
>  static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) { return false; }
>  static inline bool others_have_blocked(struct rq *rq) { return false; }
>  static inline void update_blocked_load_tick(struct rq *rq) {}
> -static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) {}
>  #endif /* !CONFIG_NO_HZ_COMMON */
>
> +static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
> +{
> +       if (!has_blocked_load)
> +               rq->has_blocked_load = 0;
> +}
> +
>  static bool __update_blocked_others(struct rq *rq, bool *done)
>  {
>         bool updated;
> @@ -15073,8 +15082,11 @@ void sched_balance_trigger(struct rq *rq)
>          * Don't need to rebalance while attached to NULL domain or
>          * runqueue CPU is not active
>          */
> -       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq))))
> +       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq)))) {
> +               if (rq->has_blocked_load)
> +                       sched_balance_update_blocked_averages(cpu_of(rq));
>                 return;
> +       }
>
>         if (time_after_eq(jiffies, rq->next_balance))
>                 raise_softirq(SCHED_SOFTIRQ);
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 32f76551a0c5..dc2ead0b06cc 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1235,7 +1235,6 @@ struct rq {
>  #ifdef CONFIG_NO_HZ_COMMON
>         unsigned int            nohz_tick_stopped;
>         atomic_t                nohz_flags;
> -       unsigned int            has_blocked_load;
>         unsigned long           last_blocked_load_update_tick;
>         call_single_data_t      nohz_csd;
>  #endif /* CONFIG_NO_HZ_COMMON */
> @@ -1337,6 +1336,7 @@ struct rq {
>
>         struct list_head cfs_tasks;
>
> +       unsigned int            has_blocked_load;
>         struct sched_avg        avg_rt;
>         struct sched_avg        avg_dl;
>  #ifdef CONFIG_HAVE_SCHED_AVG_IRQ
> ---
>
> I think the setting rq->has_blocked_load in put_prev_task_fair() is safe
> for SMP too since this is only checked from nohz handler for the
> nohz_idle_cpus - nohz CPU would have populate this anyway when going
> idle from nohz_balance_enter_idle().
>
> If the load was decayed fully and a short running task (short enough to
> not accumulate any PELT segments) runs, the rq->has_blocked_load
> indicator would be set spuriously and get corrected soon at next nohz
> balance trigger. On null domain CPUs, only the tick care about it.
>
> Thoughts?
>
> --
> Thanks and Regards,
> Prateek
>

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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-12-01  7:16     ` Vincent Guittot
@ 2026-12-01  7:36       ` Vincent Guittot
  2026-12-01  8:08         ` K Prateek Nayak
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Guittot @ 2026-12-01  7:36 UTC (permalink / raw)
  To: K Prateek Nayak
  Cc: Zhongqiu Han, Christian Loehle, Ingo Molnar, Peter Zijlstra,
	Juri Lelli, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Valentin Schneider, mehmet.fide, linux-kernel,
	Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY SCALING FRAMEWORK

On Tue, 1 Dec 2026 at 08:16, Vincent Guittot <vincent.guittot@linaro.org> wrote:
>
> On Tue, 1 Dec 2026 at 04:49, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
> >
> > Hello Zhongqiu,
> >
> > On 11/30/2026 7:14 PM, Zhongqiu Han wrote:
> > > Hi Christian,
> > >
> > > Thanks for the patch.
> > >
> > > On 11/30/2026 4:10 AM, Christian Loehle wrote:
> > >> Schedutil was restricted to SMP when the scheduler did not provide
> > >> utilization data on UP. Commit cac5cefbade9 ("sched/smp: Make SMP
> > >> unconditional") enabled PELT accounting on UP, but schedutil's Kconfig
> > >> restrictions remained.
> > >
> > > [Adding Rafael, Viresh and linux-pm]
> > >
> > > The Kconfig change looks fine, but one thing may be worth discussing:
> > > on a single CPU rq->sd is NULL, so the blocked load update never runs
> > > and rq->avg_rt/avg_dl don't decay until another RT/DL task runs.
> > > Couldn't that leave the frequency stuck high? Should NULL-domain CPUs
> > > decay these from the tick, like scx_tick() does?
> >
> > Yes, it does make sense to update the averages if we get a tick on a
> > NULL domain CPU - isolated ones should not get a tick and the remote
> > handlers should do the right thing for the regular nohz ones.
> >
> > Something like below perhaps:
>
> Instead of spreading this here and there, we should better reuse what
> is already available, i.e.: update blocked load during the periodic
> tick and when entering idle.
> we have sched_balance_trigger and sched_balance_newidle which return
> early in UP case, we need to make sure that they will update blocked
> load in case of UP
>
> >
> >   (Only build tested)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 2d9d3d686261..16fffd6381e5 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -10386,6 +10386,15 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct t
> >         struct cfs_rq *cfs_rq = &rq->cfs;
> >         struct sched_entity *nse = NULL;
> >
> > +       /*
> > +        * Task from a different class will run next - if it is a higher
> > +        * priority class, we'll need to decau its averages next or if
> > +        * it is a lower priority class, blocked averages for fair needs
> > +        * decaying. Notify there may be some blocked load to decay.
> > +        */
> > +       if (next && next->sched_class != &fair_sched_class)
> > +               rq->has_blocked_load = 1;

I was specifically mentioning this part
We update blocked load only when there is no toher task and not when
other class preempt us at the beg of sched_balance_newidle(). We
should call it when UP too

> > +
> >  #ifdef CONFIG_FAIR_GROUP_SCHED
> >         if (next && next->sched_class == &fair_sched_class)
> >                 nse = &next->se;
> > @@ -11548,18 +11557,18 @@ static inline void update_blocked_load_tick(struct rq *rq)
> >         WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies);
> >  }
> >
> > -static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
> > -{
> > -       if (!has_blocked_load)
> > -               rq->has_blocked_load = 0;
> > -}
> >  #else /* !CONFIG_NO_HZ_COMMON: */
> >  static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) { return false; }
> >  static inline bool others_have_blocked(struct rq *rq) { return false; }
> >  static inline void update_blocked_load_tick(struct rq *rq) {}
> > -static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) {}
> >  #endif /* !CONFIG_NO_HZ_COMMON */
> >
> > +static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load)
> > +{
> > +       if (!has_blocked_load)
> > +               rq->has_blocked_load = 0;
> > +}
> > +
> >  static bool __update_blocked_others(struct rq *rq, bool *done)
> >  {
> >         bool updated;
> > @@ -15073,8 +15082,11 @@ void sched_balance_trigger(struct rq *rq)
> >          * Don't need to rebalance while attached to NULL domain or
> >          * runqueue CPU is not active
> >          */
> > -       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq))))
> > +       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq)))) {
> > +               if (rq->has_blocked_load)
> > +                       sched_balance_update_blocked_averages(cpu_of(rq));

Why not simply trigger the softirq ? We already have the periodic
update filtering in place

> >                 return;
> > +       }
> >
> >         if (time_after_eq(jiffies, rq->next_balance))
> >                 raise_softirq(SCHED_SOFTIRQ);
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index 32f76551a0c5..dc2ead0b06cc 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -1235,7 +1235,6 @@ struct rq {
> >  #ifdef CONFIG_NO_HZ_COMMON
> >         unsigned int            nohz_tick_stopped;
> >         atomic_t                nohz_flags;
> > -       unsigned int            has_blocked_load;
> >         unsigned long           last_blocked_load_update_tick;
> >         call_single_data_t      nohz_csd;
> >  #endif /* CONFIG_NO_HZ_COMMON */
> > @@ -1337,6 +1336,7 @@ struct rq {
> >
> >         struct list_head cfs_tasks;
> >
> > +       unsigned int            has_blocked_load;
> >         struct sched_avg        avg_rt;
> >         struct sched_avg        avg_dl;
> >  #ifdef CONFIG_HAVE_SCHED_AVG_IRQ
> > ---
> >
> > I think the setting rq->has_blocked_load in put_prev_task_fair() is safe
> > for SMP too since this is only checked from nohz handler for the
> > nohz_idle_cpus - nohz CPU would have populate this anyway when going
> > idle from nohz_balance_enter_idle().
> >
> > If the load was decayed fully and a short running task (short enough to
> > not accumulate any PELT segments) runs, the rq->has_blocked_load
> > indicator would be set spuriously and get corrected soon at next nohz
> > balance trigger. On null domain CPUs, only the tick care about it.
> >
> > Thoughts?
> >
> > --
> > Thanks and Regards,
> > Prateek
> >

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

* Re: [PATCH] cpufreq: schedutil: Allow use on UP kernels
  2026-12-01  7:36       ` Vincent Guittot
@ 2026-12-01  8:08         ` K Prateek Nayak
  0 siblings, 0 replies; 8+ messages in thread
From: K Prateek Nayak @ 2026-12-01  8:08 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: Zhongqiu Han, Christian Loehle, Ingo Molnar, Peter Zijlstra,
	Juri Lelli, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Valentin Schneider, mehmet.fide, linux-kernel,
	Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY SCALING FRAMEWORK

Hello Vincent,

On 12/1/2026 1:06 PM, Vincent Guittot wrote:
>>> @@ -15073,8 +15082,11 @@ void sched_balance_trigger(struct rq *rq)
>>>          * Don't need to rebalance while attached to NULL domain or
>>>          * runqueue CPU is not active
>>>          */
>>> -       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq))))
>>> +       if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq)))) {
>>> +               if (rq->has_blocked_load)
>>> +                       sched_balance_update_blocked_averages(cpu_of(rq));
> 
> Why not simply trigger the softirq ? We already have the periodic
> update filtering in place

Ack! That should work too. I was overthinking this.

>>>                 return;
>>> +       }
>>>
>>>         if (time_after_eq(jiffies, rq->next_balance))
>>>                 raise_softirq(SCHED_SOFTIRQ);

-- 
Thanks and Regards,
Prateek


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

end of thread, other threads:[~2026-12-01  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 20:10 [PATCH] cpufreq: schedutil: Allow use on UP kernels Christian Loehle
2026-11-30  3:46 ` K Prateek Nayak
2026-11-30 13:36 ` Vincent Guittot
2026-11-30 13:44 ` Zhongqiu Han
2026-12-01  3:48   ` K Prateek Nayak
2026-12-01  7:16     ` Vincent Guittot
2026-12-01  7:36       ` Vincent Guittot
2026-12-01  8:08         ` K Prateek Nayak

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®