From: Chen Yu <yu.c.chen@intel.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>,
<tim.c.chen@linux.intel.com>, <kayracizmeci@gmail.com>,
<kprateek.nayak@amd.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>, <linux-kernel@vger.kernel.org>,
<zhanxusheng@xiaomi.com>
Subject: Re: [PATCH] sched/cache: Check reduced capacity before alb_break_llc()
Date: Fri, 30 Oct 2026 23:04:23 +0800 [thread overview]
Message-ID: <auSx92BuZKD4OyrO@chenyu-dev> (raw)
In-Reply-To: <20261029085530.4054159-1-zhanxusheng1024@gmail.com>
On Thu, Oct 29, 2026 at 04:55:29PM +0800, Zhan Xusheng wrote:
> Hi Chenyu,
>
> On Thu, Oct 29, 2026 at 04:18:32PM +0800, Chen Yu wrote:
> > Moving the capacity check earlier seems to completely ignore the
> > task's LLC preference. It seems to be a trade-off between choosing
> > CPU capacity and cache re-population on a remote LLC, and cross-LLC
> > access latency due to cross-LLC migration. I don't know which one has
> > more impact, it looks to be workload-specific. May I know which
> > benchmark/platform you used to find this issue? I'd like to launch
> > hackbench/tbench/schbenh/netperf(or yours) to evaluate the impact.
>
> No benchmark, I found it reading the code and reproduced it in QEMU
> with -smp 4,sockets=2,cores=2 and IRQ_TIME_ACCOUNTING. A module spends
> 600us of every 1ms in an hrtimer handler on CPU0, CPU1 runs a pinned
> busy loop, and the test process has one busy thread and one thread that
> only sleeps (cache aware scheduling skips single-threaded processes).
> It starts pinned to CPU0 and is then allowed on all CPUs. I can send
> the module and the program.
>
> The LLC preference is only overridden when the capacity check fires,
> which is the same condition as your reduced_cap_alb().
>
> > May I know if the issue is because of the
> > if (env->src_rq->nr_running <= 1)
> > return true
> > in alb_break_llc()?
>
> Yes.
>
> > If yes, to mitigate the possible impact, do you think tuning the
> > alb_break_llc() would be safer?
>
> I tried your two patches on the same setup. The task still stays on
> CPU0 for the whole 20 seconds, at about 1.8e7 iterations/s against
> 4.6e7 with cache aware scheduling disabled. Without the early return,
> alb_break_llc() falls through to can_migrate_llc(), which still
> forbids moving the task off its preferred LLC here.
>
It seems that can_migrate_llc() thinks a 60% IRQ pressure does not prevent
the task from being migrated away from its preferred LLC, because after moving
a task with 1024 util to LLC1, the remaining util still fits LLC0.
Suppose, before the migration check, in your scenario:
task p1 has util 1024 on CPU0, and task p2 has util 1024 on CPU1;
LLC0 cap = 1024 + 1024*0.4 = 1433 (IRQ pressure)
LLC1 cap = 2048
If p1 is moved from LLC0 to LLC1, the remaining util for LLC0 is 1024
(only p2's). Since 1024 < 1433 * 0.75 (fits_llc_capacity(src_util, src_cap)),
can_migrate_llc() returns mig_forbid.
That is to say, only if the IRQ pressure is above 66.7% in your test case does
fits_llc_capacity() return false, which allows the task migration.
Side note: while looking at fits_llc_capacity(), I found there might be a mismatch
in comparing a task's util and CPU capacity directly. The former is based on rq_clock_task,
which is transparent to IRQ pressure, while the latter is calculated from IRQ pressure,
comparing task util and CPU capacity is inaccurate. But since it is derived from
group_is_overloaded(), which already compares CPU capacity and task util, we can keep
it as it is until we see problems from this. After all, they are heuristic.
I'll run hackbench and netperf (which should trigger higher IRQ pressure). If there is
no issue, I think your original change is OK.
thanks,
Chenyu
next prev parent reply other threads:[~2026-10-30 15:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 2:36 Zhan Xusheng
2026-10-29 7:13 ` Kayra Cizmeci
2026-10-29 7:50 ` Zhan Xusheng
2026-10-29 8:13 ` Kayra Cizmeci
2026-10-29 8:18 ` Chen Yu
2026-10-29 8:18 ` Chen Yu
2026-10-29 8:55 ` Zhan Xusheng
2026-10-30 15:04 ` Chen Yu [this message]
2026-10-30 23:24 ` 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=auSx92BuZKD4OyrO@chenyu-dev \
--to=yu.c.chen@intel.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kayracizmeci@gmail.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=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®