From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>, vincent.guittot@linaro.org
Cc: mingo@redhat.com, juri.lelli@redhat.com,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
linux-kernel@vger.kernel.org, Chris Mason <clm@meta.com>,
Joseph Salisbury <joseph.salisbury@oracle.com>,
Adam Li <adamli@os.amperecomputing.com>,
Hazem Mohamed Abuelfotoh <abuehaze@amazon.com>,
Josh Don <joshdon@google.com>
Subject: Re: [PATCH 2/4] sched/fair: Small cleanup to sched_balance_newidle()
Date: Wed, 12 Nov 2025 20:58:23 +0530 [thread overview]
Message-ID: <01dcb63e-9ebd-42ca-9418-a822bf081bfc@linux.ibm.com> (raw)
In-Reply-To: <20251112150818.GG4068168@noisy.programming.kicks-ass.net>
On 11/12/25 8:38 PM, Peter Zijlstra wrote:
> On Wed, Nov 12, 2025 at 03:42:41PM +0100, Peter Zijlstra wrote:
>
>>> if sd is null, i think we are skipping these compared to earlier.
>>>
>>> t0 = sched_clock_cpu(this_cpu);
>>> sched_balance_update_blocked_averages(this_cpu);
>>
>> let me pull that sched_balance_update_blocked_averages() thing up a few
>> lines.
>
> Something like so..
>
> ---
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9946,15 +9946,11 @@ static unsigned long task_h_load(struct
> }
> #endif /* !CONFIG_FAIR_GROUP_SCHED */
>
> -static void sched_balance_update_blocked_averages(int cpu)
> +static void __sched_balance_update_blocked_averages(struct rq *rq)
> {
> bool decayed = false, done = true;
> - struct rq *rq = cpu_rq(cpu);
> - struct rq_flags rf;
>
> - rq_lock_irqsave(rq, &rf);
> update_blocked_load_tick(rq);
> - update_rq_clock(rq);
>
> decayed |= __update_blocked_others(rq, &done);
> decayed |= __update_blocked_fair(rq, &done);
> @@ -9962,7 +9958,15 @@ static void sched_balance_update_blocked
> update_blocked_load_status(rq, !done);
> if (decayed)
> cpufreq_update_util(rq, 0);
> - rq_unlock_irqrestore(rq, &rf);
> +}
> +
> +static void sched_balance_update_blocked_averages(int cpu)
> +{
> + struct rq *rq = cpu_rq(cpu);
> +
> + guard(rq_lock_irqsave)(rq);
> + update_rq_clock(rq);
> + __sched_balance_update_blocked_averages(rq);
> }
>
> /********** Helpers for sched_balance_find_src_group ************************/
> @@ -12865,6 +12869,8 @@ static int sched_balance_newidle(struct
> if (!cpu_active(this_cpu))
> return 0;
>
> + __sched_balance_update_blocked_averages(this_rq);
> +
is this done only when sd == null ?
> /*
> * This is OK, because current is on_cpu, which avoids it being picked
> * for load-balance and preemption/IRQs are still disabled avoiding
> @@ -12891,7 +12897,6 @@ static int sched_balance_newidle(struct
> raw_spin_rq_unlock(this_rq);
>
> t0 = sched_clock_cpu(this_cpu);
> - sched_balance_update_blocked_averages(this_cpu);
>
> rcu_read_lock();
> for_each_domain(this_cpu, sd) {
Referring to commit,
9d783c8dd112a (sched/fair: Skip update_blocked_averages if we are defering load balance)
I think vincent added the max_newidle_lb_cost check since sched_balance_update_blocked_averages is costly.
next prev parent reply other threads:[~2025-11-12 15:29 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 16:06 [PATCH 0/4] sched: The newidle balance regression Peter Zijlstra
2025-11-07 16:06 ` [PATCH 1/4] sched/fair: Revert max_newidle_lb_cost bump Peter Zijlstra
2025-11-14 12:19 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-11-17 16:23 ` tip-bot2 for Peter Zijlstra
2025-11-07 16:06 ` [PATCH 2/4] sched/fair: Small cleanup to sched_balance_newidle() Peter Zijlstra
2025-11-10 13:55 ` Dietmar Eggemann
2025-11-10 14:04 ` Peter Zijlstra
2025-11-12 14:37 ` Shrikanth Hegde
2025-11-12 14:42 ` Peter Zijlstra
2025-11-12 15:08 ` Peter Zijlstra
2025-11-12 15:28 ` Shrikanth Hegde [this message]
2025-11-14 9:49 ` Peter Zijlstra
2025-11-14 10:22 ` Vincent Guittot
2025-11-14 11:05 ` Peter Zijlstra
2025-11-14 13:11 ` Vincent Guittot
2025-11-14 12:19 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-11-17 16:23 ` tip-bot2 for Peter Zijlstra
2025-11-07 16:06 ` [PATCH 3/4] sched/fair: Small cleanup to update_newidle_cost() Peter Zijlstra
2025-11-14 12:19 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-11-17 16:23 ` tip-bot2 for Peter Zijlstra
2025-11-07 16:06 ` [PATCH 4/4] sched/fair: Proportional newidle balance Peter Zijlstra
2025-11-10 13:55 ` Dietmar Eggemann
2025-11-11 9:07 ` Adam Li
2025-11-11 9:20 ` Peter Zijlstra
2025-11-12 12:04 ` Adam Li
2025-11-12 13:41 ` Peter Zijlstra
2025-11-12 15:42 ` Shrikanth Hegde
2025-11-14 9:35 ` Peter Zijlstra
2025-11-14 12:18 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-11-17 16:23 ` tip-bot2 for Peter Zijlstra
2026-01-18 20:46 ` [PATCH 4/4] " Mario Roy
2026-01-23 10:50 ` Peter Zijlstra
2026-01-23 11:03 ` Peter Zijlstra
2026-01-23 12:24 ` K Prateek Nayak
2026-01-28 4:08 ` K Prateek Nayak
2026-01-27 4:15 ` Mario Roy
2026-01-27 10:40 ` Peter Zijlstra
2026-01-27 15:17 ` Peter Zijlstra
2026-01-30 1:44 ` Mario Roy
2026-01-30 4:14 ` Mario Roy
2026-02-24 9:13 ` [tip: sched/core] sched/fair: More complex proportional " tip-bot2 for Peter Zijlstra
2026-01-25 12:22 ` [PATCH 4/4] sched/fair: Proportional " Mohamed Abuelfotoh, Hazem
2026-01-27 8:44 ` Peter Zijlstra
2026-01-28 15:48 ` Mohamed Abuelfotoh, Hazem
2026-01-29 9:19 ` Peter Zijlstra
2026-01-29 9:24 ` Peter Zijlstra
2026-01-30 16:12 ` Mohamed Abuelfotoh, Hazem
2026-01-30 13:16 ` Mohamed Abuelfotoh, Hazem
2026-02-02 10:51 ` Peter Zijlstra
2026-02-02 11:07 ` Mohamed Abuelfotoh, Hazem
2026-02-04 12:45 ` Mohamed Abuelfotoh, Hazem
2026-02-04 13:27 ` Peter Zijlstra
2026-02-04 13:59 ` Mohamed Abuelfotoh, Hazem
2026-02-04 14:05 ` Peter Zijlstra
2026-02-04 22:48 ` Mohamed Abuelfotoh, Hazem
2026-01-27 8:50 ` Peter Zijlstra
2026-01-27 9:13 ` Peter Zijlstra
2026-01-28 16:24 ` Mohamed Abuelfotoh, Hazem
2026-01-28 16:03 ` Mohamed Abuelfotoh, Hazem
2026-04-29 8:51 ` Qing Wang
2026-05-06 2:44 ` [PATCH] sched/fair: Replace random newidle_balance with Bresenham accumulator Qing Wang
2026-05-13 2:21 ` Qing Wang
2026-05-13 5:29 ` K Prateek Nayak
2026-05-14 2:22 ` Qing Wang
2026-06-02 5:46 ` [PATCH v2] " Qing Wang
2025-11-10 19:47 ` [PATCH 0/4] sched: The newidle balance regression Chris Mason
2025-11-11 19:08 ` Josh Don
2025-11-12 21:59 ` Chris Mason
2025-11-14 9:37 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01dcb63e-9ebd-42ca-9418-a822bf081bfc@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=abuehaze@amazon.com \
--cc=adamli@os.amperecomputing.com \
--cc=bsegall@google.com \
--cc=clm@meta.com \
--cc=dietmar.eggemann@arm.com \
--cc=joseph.salisbury@oracle.com \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.