mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: Li kunyu <likunyu@open-hieco.net>
Cc: <peterz@infradead.org>, <bsegall@google.com>,
	<dietmar.eggemann@arm.com>, <juri.lelli@redhat.com>,
	<kprateek.nayak@amd.com>, <linux-kernel@vger.kernel.org>,
	<mgorman@suse.de>, <mingo@redhat.com>, <rostedt@goodmis.org>,
	<vincent.guittot@linaro.org>, <vschneid@redhat.com>,
	<tim.c.chen@intel.com>, <wujianyong@hygon.cn>
Subject: Re: [RFC PATCH 0/6] sched/fair: Introduce the SMT BUDDY ASSIST feature
Date: Fri, 23 Oct 2026 00:02:43 +0800	[thread overview]
Message-ID: <atozo8vLDlOB6Vau@chenyu-dev> (raw)
In-Reply-To: <20261022100821.981VXwAZyKKAsG00eaxoDO9kollDWxuTGq7ALzXMQDc@z>

Hi Kunyu,

On Thu, Oct 22, 2026 at 06:08:21PM +0800, Li kunyu wrote:
> From: Peter Zijlstra <peterz@infradead.org>
> 
> On Thu, Oct 22, 2026 at 03:40:44PM +0800, Peter Zijlstra wrote:
> > On Tue, Oct 20, 2026 at 04:37:40PM +0800, Li kunyu wrote:
> > > [Problem]
> > > 
> > > It was found that on servers equipped with the Hygon 7447v CPU (Model 7,
> > > 384 logical cores), migrating tasks across LLC scheduling domains during
> > > load balancing caused significant performance degradation:
> > > 
> > > 1. A low L3 cache hitting rate (due to factors such as non-shared L3
> > > caches).
> > > 
> > > 2. The traversal overhead of higher-level scheduling domains (e.g.,
> > > cross-NUMA scheduling domains).
> > > 
> > > Similar issues were also observed on CPUs from other vendors during
> > > testing, though the degree of memory bandwidth increase and other
> > > latency effects varied. Consequently, a series of patches was developed
> > > to address and improve these issues.
> > > 
> > > 
> > > [Solution]
> > > 
> > > This RFC patch series introduces the SMT_BUDDY_ASSIST scheduling
> > > feature. The main work is as follows:
> > > 
> > > 1. Push CFS tasks to SMT sibling CPUs during periodic load balancing.
> > > 
> > > 2. Skip SMT-domain balancing after a successful push and avoid pulling
> > > the pushed task back.
> > > 
> > > 3. Restrict newidle balancing so it does not pull from higher-level
> > > scheduling domains.
> > > 
> > > 4. Compensate for the resulting load imbalance with a burst-task wakeup
> > > path that sends tasks to idle CPUs.
> > 
> > So you're combatting undue LLC migrations with brute force :-( Mostly
> > this looks like something where cache aware scheduling should help, no?
> > That ought to make cross-LLC migrations less attractive.
> > 
> > Now, I realize that cache-aware scheduling as is won't help stream; when
> > build using OpenMP the whole thing is one big process and cache-aware
> > mostly gives up, when build using MPI its a ton of single threads and
> > cache-aware will ignore them.
> > 
> > Still, I think you really should look that way, perhaps investigate if
> > something like:
> > 
> >   https://patch.msgid.link/cover.1787955777.git.tim.c.chen%40linux.intel.com
> > 
> > can help you.
> 
> Thank you for your suggestion. I looked at this patch series and think
> the way it exposes the interface to users ("always" | "advise" |
> "never") is quite good. We will add the related interfaces in a subsequent
> version.
> 
>

If I understand correctly, the goal of your patch set is to inhibit cross-node
task migration so as to keep memory locality.

Patch 4 is the main one, which forbids the newly-idle cross-node balancing. As
a result of Patch 4, more tasks end up on a single node, so the kernel needs to
spread them within that node more aggressively, this is why Patches 1, 2, 3 and
5 were introduced.

Before digging further into the design, I think one question needs to be clarified:
In the scenario you are trying to optimize, do the workload's threads share data
with each other?

1. If the threads share data with each other, then leveraging cache-aware scheduling
   with prctl to put them together in the same LLC/node might be a good choice.
   Furthermore, there is a proposal [1] to enhance prctl to allow the user to specify
   how aggressively the threads should be aggregated, which would work in the "stream"
   case.

2. If the threads do not share data with each other and have a high memory footprint,
   then leaving them where their memory resides would be a good choice. This is what
   NUMA balancing tries to achieve, and it is possible that threads of the same process
   are spread on different nodes.

From the [Problem] section in the cover letter, it seems you are trying to address case 2?
If this is the case, why doesn't NUMA balancing help to inhibit the cross-node task migration?
Or is it because NUMA balancing is disabled on your platform?

Besides, there is a patch set to extend cache-aware scheduling to cover multiple
preferred LLCs and nodes [2], so as to mitigate cross-LLC/cross-node latency as much as
possible, not sure whether this work addresses the issue you mentioned.

[1] https://lore.kernel.org/lkml/tencent_93116D14C771DC8C988C10E3C634BE0CC107@qq.com/
[2] https://lore.kernel.org/lkml/20260827122816.756234-1-wujianyong@hygon.cn/

thanks,
Chenyu

> > I'm not sure why you're doing the SMT push thing; but there's this
> > thing:
> > 
> >   https://patch.msgid.link/20261002154415.2270586-8-vincent.guittot%40linaro.org
> 
> I previously looked at the relevant patches, and my implementation
> approach was slightly different. Here, I mainly focused on quickly
> distributing tasks to the SMT sibling CPUs; during this load-balancing
> cycle I could still pull tasks, achieving faster CPU load balancing
> (mainly for rapid local task dispersal, and it does not substantially
>  conflict with the approach in that patch). In subsequent patches, I
> also made new considerations: checking the cfs.h_nr_runnable count and
> no longer focusing on sleeping tasks.
> 
> Task pushing at the SMT level is part of the overall functionality.
> Combined with the changes in select_task_rq_fair(), it achieves rapid
> overall task dispersal.
> 
> Combined with the aforementioned user interface, this makes it easy to
> enable or disable SMT-level task pushing.
> 
> 
> thinks,
> kunyu

  reply	other threads:[~2026-10-22 16:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  8:37 [RFC PATCH 0/6] sched/fair: Introduce the SMT_BUDDY_ASSIST feature Li kunyu
2026-10-20  8:37 ` [RFC PATCH 1/6] sched/fair: Add SMT sibling push in periodic load balance Li kunyu
2026-10-21 12:34   ` Peter Zijlstra
2026-10-20  8:37 ` [RFC PATCH 2/6] sched/fair: Add is_smt_buddy_run() to skip SMT domain Li kunyu
2026-10-21 12:35   ` Peter Zijlstra
2026-10-20  8:37 ` [RFC PATCH 3/6] sched/fair: SMT sibling exclusion after successful push Li kunyu
2026-10-21 12:39   ` Peter Zijlstra
2026-10-20  8:37 ` [RFC PATCH 4/6] sched/fair: Restrict newidle balance to LLC domain Li kunyu
2026-10-21 12:42   ` Peter Zijlstra
2026-10-20  8:37 ` [RFC PATCH 5/6] sched/fair: Add task burst threshold for large-scale bursts Li kunyu
2026-10-21 12:54   ` Peter Zijlstra
2026-10-20  8:37 ` [RFC PATCH 6/6] sched/docs: Add documentation for SMT Buddy Assist feature Li kunyu
2026-10-21 12:55   ` Peter Zijlstra
2026-10-21 12:44 ` [RFC PATCH 0/6] sched/fair: Introduce the SMT_BUDDY_ASSIST feature Kayra Cizmeci
2026-10-22  7:40 ` Peter Zijlstra
2026-10-22 10:08   ` [RFC PATCH 0/6] sched/fair: Introduce the SMT BUDDY ASSIST feature Li kunyu
2026-10-22 16:02     ` Chen Yu [this message]
2026-10-22 20:25 ` [RFC PATCH 0/6] sched/fair: Introduce the SMT_BUDDY_ASSIST feature Tim Chen

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=atozo8vLDlOB6Vau@chenyu-dev \
    --to=yu.c.chen@intel.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=likunyu@open-hieco.net \
    --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@intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wujianyong@hygon.cn \
    /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®