mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Mason <clm@meta.com>
To: Peter Zijlstra <peterz@infradead.org>, Chris Mason <clm@fb.com>
Cc: vincent.guittot@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] sched/fair: bump sd->max_newidle_lb_cost when newidle balance fails
Date: Thu, 26 Jun 2025 06:58:28 -0400	[thread overview]
Message-ID: <872c057e-5e2f-4cbf-943a-072b6015fee9@meta.com> (raw)
In-Reply-To: <20250626070057.GE1613200@noisy.programming.kicks-ass.net>

On 6/26/25 3:00 AM, Peter Zijlstra wrote:
> On Tue, Jun 24, 2025 at 01:48:08PM -0700, Chris Mason wrote:

[ ... ]

> For the non-RFC version, please split this into a code move and a code
> change -- I had to stare waaay to long to spot the difference (if we
> keep this code movement at all).

Sure

> 
>>  /*
>>   * Check this_cpu to ensure it is balanced within domain. Attempt to move
>>   * tasks if there is an imbalance.
>> @@ -11782,12 +11808,14 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
>>  
>>  	group = sched_balance_find_src_group(&env);
>>  	if (!group) {
>> +		update_newidle_cost(sd, sd->max_newidle_lb_cost + sd->max_newidle_lb_cost / 2);
>>  		schedstat_inc(sd->lb_nobusyg[idle]);
>>  		goto out_balanced;
>>  	}
>>  
>>  	busiest = sched_balance_find_src_rq(&env, group);
>>  	if (!busiest) {
>> +		update_newidle_cost(sd, sd->max_newidle_lb_cost + sd->max_newidle_lb_cost / 2);
>>  		schedstat_inc(sd->lb_nobusyq[idle]);
>>  		goto out_balanced;
>>  	}
> 
> So sched_balance_rq() is used for pretty much all load-balancing, not
> just newidle.
> 
> Either make this conditional like:
> 
> 	if (idle == CPU_NEWLY_IDLE)
> 		update_newidle_cost(...);
> 
> or do it all the callsite, where we find !pulled_task (ie failure).
> 
> Specifically, we already do update_newidle_cost() there, perhaps inflate
> the cost there instead?
> 
> 	if (!pulled_tasks)
> 		domain_cost += sysctl_sched_migration_cost;

Got it, I'll play with that.  Vincent, was there a benchmark I can use
to see if I've regressed the case you were focused on?

-chris


  parent reply	other threads:[~2025-06-26 10:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 20:48 Chris Mason
2025-06-26  7:00 ` Peter Zijlstra
2025-06-26  7:44   ` Vincent Guittot
2025-06-26 10:58   ` Chris Mason [this message]
2025-06-26 14:26     ` Vincent Guittot
2025-06-26 14:55       ` Chris Mason
2025-06-27 13:32         ` Vincent Guittot
2025-07-04 15:46           ` Vincent Guittot
2025-06-26 11:47   ` Jianyong Wu
2025-06-26 13:48     ` Chris Mason
2025-06-26 14:02       ` 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=872c057e-5e2f-4cbf-943a-072b6015fee9@meta.com \
    --to=clm@meta.com \
    --cc=clm@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /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 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®