mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Yu <chen.yu@linux.dev>
To: Luo Gengkun <luogengkun@huaweicloud.com>, tim.c.chen@linux.intel.com
Cc: peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, tim.c.chen@linux.intel.com,
	yu.c.chen@intel.com, kprateek.nayak@amd.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 1/2] sched/cache: Reduce the overhead of task_cache_work by only scan the visisted cpus
Date: Mon, 16 Nov 2026 15:24:25 +0800	[thread overview]
Message-ID: <avqvqemiHxuQVH8b@three-body> (raw)
In-Reply-To: <20261111110409.1498035-2-luogengkun@huaweicloud.com>

On Wed, Nov 11, 2026 at 11:04:08AM +0000, Luo Gengkun wrote:
> Date: Wed, 11 Nov 2026 11:04:08 +0000
> From: Luo Gengkun <luogengkun@huaweicloud.com>
> To: peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com,
>  vincent.guittot@linaro.org, tim.c.chen@linux.intel.com,
>  yu.c.chen@intel.com, kprateek.nayak@amd.com
> Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com,
>  mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org
> Subject: [PATCH v11 1/2] sched/cache: Reduce the overhead of
>  task_cache_work by only scan the visisted cpus
> X-Mailer: git-send-email 2.34.1
> 
> 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().
> 
> Below are the Redis test results conducted on AMD server.
> 
> When NUMA balancing is disabled:
> 
>   valkey-benchmark rps  |      baseline       |         schedcache              |     schedcache_visit
>                         |  (no cache aware)   |    (without this series)        |     (with this series)
>   ----------------------+---------------------+---------------------+-----------+-------------------+--------
>                         |   p99 latency(ms)   |    p99 latency(ms)  |   DIFF(%) |   p99 latency(ms) |  DIFF(%)
>   400000                |      0.436          |        0.554        |   -25.68% |         0.441     |   -1.14%
> 
>   Additionally, the output of perf top -e cycles:k highlights the overhead
>   incurred by task_cache_work():
> 
>   valkey-benchmark rps  |         schedcache                        |     schedcache_visit
>                         |    (without this series)                  |     (with this series)
>   ----------------------+-------------------------------------------+---------------------------------------
>   400000                |  0.81%  [kernel]  [k] task_cache_work     |  0.02%  [kernel]  [k] task_cache_work
> 
> The trace data is shown below:
> 
> echo NO_SC_VISIT > /sys/kernel/debug/sched/features
>     redis-server-24660   [195] .....  2916.005989: sched_cache_scan: comm=redis-server pid=24660 scan=384
>  valkey-benchmar-48836   [317] .....  2916.005993: sched_cache_scan: comm=valkey-benchmar pid=48836 scan=384
>  valkey-benchmar-48487   [310] .....  2916.006002: sched_cache_scan: comm=valkey-benchmar pid=48487 scan=384
> 
> echo SC_VISIT > /sys/kernel/debug/sched/features
>     redis-server-29080   [225] .....  2876.257909: sched_cache_scan: comm=redis-server pid=29080 scan=14
>     redis-server-26694   [018] .....  2876.257909: sched_cache_scan: comm=redis-server pid=26694 scan=13
>  valkey-benchmar-48198   [103] .....  2876.257909: sched_cache_scan: comm=valkey-benchmar pid=48198 scan=16
>

SC_VISIT is not in the formal patch, so maybe adjust the comment above to say that this SC_VISIT is a trial
test feature and provide the link. But it is still OK to keep this as it is now.

Tim, may I know if this version looks good to you?

thanks,
Chenyu 
> 
> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Tested-by: Chen Yu <yu.c.chen@intel.com>
> Reviewed-by: Chen Yu <yu.c.chen@intel.com>
> Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com>
> 

  reply	other threads:[~2026-11-16  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 11:04 [PATCH v11 0/2] Cache aware scheduling: Reduce the overhead of task_cache_work Luo Gengkun
2026-11-11 11:04 ` [PATCH v11 1/2] sched/cache: Reduce the overhead of task_cache_work by only scan the visisted cpus Luo Gengkun
2026-11-16  7:24   ` Chen Yu [this message]
2026-11-11 11:04 ` [PATCH v11 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=avqvqemiHxuQVH8b@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=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 \
    --cc=yu.c.chen@intel.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®