From: Chen Yu <yu.c.chen@intel.com>
To: Luo Gengkun <luogengkun@huaweicloud.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>,
<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
<tim.c.chen@linux.intel.com>, <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>, <chen.yu@linux.dev>
Subject: Re: [PATCH v10 1/2] sched/cache: Reduce the overhead of task_cache_work by only scan the visisted cpus
Date: Thu, 22 Oct 2026 00:26:50 +0800 [thread overview]
Message-ID: <atjnyuXpcvFZ0xpz@chenyu-dev> (raw)
In-Reply-To: <20261009032943.95091-2-luogengkun@huaweicloud.com>
On Fri, Oct 09, 2026 at 03:29:42AM +0000, Luo Gengkun wrote:
> The overhead of task_cache_work() is high, especially in multi-NUMA systems.
> Currently, task_cache_work() tries to find the pref_llc by scanning all CPUs
> in the system. However, most of these scans are meaningless, such as those
> for CPUs that have never been visited or were accessed a long time ago.
>
> To address this problem, introduce visited_cpus to track the visited CPUs
> and evict them once they have not been accessed for a duration exceeding
> llc_epoch_affinity_timeout.
>
> Now that we know exactly which CPUs to scan from visited_cpus, we can remove
> get_scan_cpumasks().
>
> Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com>
>
Thanks Prateek for popping this patch up, and thanks Gengkun for the continuous
optimization on this. I asked AI to launch a full hackbench test on a Xeon with
4 LLCs per node, especially to test the case where the LLC is saturated, under
which scenario the contention for the visit_cpu mask is high. The test shows no
regression. So from a code design point of view, this change is a good optimization
to reduce the potential overhead, and also paves the way for the multiple preferred
LLC/node work that Jianyong is doing IMO,
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
thanks,
Chenyu
=========================================
Hackbench comparison
BASE: cas_on_base
TEST: cas_on_visit
=========================================
MODE G FD | BASE(s) | TEST(s) | DIFF% | RESULT
------- -- ----+-----------------+-----------------+---------+----------
process 1 4 | 0.329/16.1% | 0.302/27.8% | 8.21% | IMPROVED
threads 2 16 | 222.206/2.3% | 215.147/0.9% | 3.18% | IMPROVED
threads 2 20 | 26.031/14.3% | 24.097/7.4% | 7.43% | IMPROVED
threads 4 8 | 4.338/26.6% | 3.965/31.5% | 8.60% | IMPROVED
next prev parent reply other threads:[~2026-10-21 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 3:29 [PATCH v10 0/2] Cache aware scheduling: Reduce the overhead of task_cache_work Luo Gengkun
2026-10-09 3:29 ` [PATCH v10 1/2] sched/cache: Reduce the overhead of task_cache_work by only scan the visisted cpus Luo Gengkun
2026-10-21 4:30 ` K Prateek Nayak
2026-10-21 16:26 ` Chen Yu [this message]
2026-10-21 21:46 ` Tim Chen
2026-10-09 3:29 ` [PATCH v10 2/2] -- DO NOT APPLY!!! -- sched/cache/debug: Add trace event and sched feature to track scan cost Luo Gengkun
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=atjnyuXpcvFZ0xpz@chenyu-dev \
--to=yu.c.chen@intel.com \
--cc=bsegall@google.com \
--cc=chen.yu@linux.dev \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luogengkun@huaweicloud.com \
--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 \
/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®