mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Yu <chen.yu@linux.dev>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Chen Yu <yu.c.chen@intel.com>,
	Zhan Xusheng <zhanxusheng1024@gmail.com>,
	peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: sched/fair: which tasks should nr_pref_llc_running be compared against?
Date: Thu, 10 Sep 2026 18:47:08 +0800	[thread overview]
Message-ID: <aqKKrMKaZORqNpwt@three-body> (raw)
In-Reply-To: <a1b1d5f9a58895b65217671678c6e02bd711241a.camel@linux.intel.com>

On Wed, Sep 09, 2026 at 10:47:11AM -0700, Tim Chen wrote:
> On Wed, 2026-09-09 at 19:40 +0800, Chen Yu wrote:
> > Yes, I think this version looks good now. While looking back at Xusheng's proposal,
> > I noticed there is another option:
> > if (env->src_rq->nr_pref_llc_running == env->src_rq->cfs.h_nr_queued) {
> > 	...
> > }
> > May I know why we did not choose this approach, is it because of the following
> > scenario?
> 
> The reason is that a common condition we are trying to avoid in
> alb_break_llc() is the following: We have one task T1 running on cpu preferring
> src LLC and another delay queued task T2 not preferring src LLC and delayed queued.
> 
> - runnable domain (current fix): h_nr_runnable == 1, nr_pref_llc_running == 1 → equal → alb_break_llc() true → suppress.
>   Correct: the only thing actually running here wants to be here; don't rip it away.
> - h_nr_queued alternative: h_nr_queued == 2, nr_pref(queued) == 1 → not equal → alb_break_llc() false → proceed to active balance, 
>   which would then break T1's locality to relieve an "imbalance"
>   that is really just a sleeping T2.
> 
>

Got it, I see.
 
> > Suppose there are 3 queued tasks: p1 and p2 prefer the src_rq, while p3 is a delayed
> > task that also prefers src_rq. In the current implementation, nr_pref_llc_running is 3
> > and h_nr_runnable is 2, so alb_break_llc() might return false. As a result, active load
> > balance would be triggered, and p1 or p2 might be migrated away, which is undesirable.
> > However, would this still be a problem after Lu Wang's active load balance guard patch
> > has been applied?
> > https://lore.kernel.org/lkml/20260903020656.3793626-1-wanglu.priv@gmail.com/
> 
> Lu Wang's patch only mitigate the migrate_llc case but not other migration reasons.
> We shouldn't have done active balance in the example I gave if we are doing
> migration for other non migrate_llc reasons.
>

Indeed. Got it. I've launched some santify tests, will report back later.

thanks,
Chenyu 

      reply	other threads:[~2026-09-10 10:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 13:50 Zhan Xusheng
2026-08-27 20:57 ` Tim Chen
2026-08-28  2:20   ` [PATCH] sched/cache: Keep nr_pref_llc_running in the runnable domain Zhan Xusheng
2026-08-28 17:08     ` Tim Chen
2026-08-30  8:17   ` sched/fair: which tasks should nr_pref_llc_running be compared against? Chen Yu
2026-09-01 20:42     ` Tim Chen
2026-09-03 15:21       ` Chen Yu
2026-09-04 20:53         ` Tim Chen
2026-09-09 11:40           ` Chen Yu
2026-09-09 17:47             ` Tim Chen
2026-09-10 10:47               ` Chen Yu [this message]

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=aqKKrMKaZORqNpwt@three-body \
    --to=chen.yu@linux.dev \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yu.c.chen@intel.com \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.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 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®