public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Introduce SIS_CACHE to choose previous CPU during task wakeup
@ 2023-11-21  7:39 Chen Yu
  2023-11-21  7:39 ` [PATCH v2 1/3] sched/fair: Record the task sleeping time as the cache hot duration Chen Yu
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Chen Yu @ 2023-11-21  7:39 UTC (permalink / raw)
  To: Peter Zijlstra, Mathieu Desnoyers, Ingo Molnar, Vincent Guittot,
	Juri Lelli
  Cc: Tim Chen, Aaron Lu, Dietmar Eggemann, Steven Rostedt, Mel Gorman,
	K Prateek Nayak, Gautham R . Shenoy, Chen Yu, linux-kernel,
	Chen Yu

v1  -> v2:
- Move the task sleep duration from sched_entity to task_struct. (Aaron Lu)
- Refine the task sleep duration calculation based on task's previous running
  CPU. (Aaron Lu)
- Limit the cache-hot idle CPU scan depth to reduce the time spend on
  searching, to fix the regression. (K Prateek Nayak)
- Add test results of the real life workload per request from Ingo
    Daytrader on a power system. (Madadi Vineeth Reddy)
    OLTP workload on Xeon Sapphire Rapids.
- Refined the commit log, added Reviewed-by tag to PATCH 1/3
  (Mathieu Desnoyers).

RFC -> v1:
- drop RFC
- Only record the short sleeping time for each task, to better honor the
  burst sleeping tasks. (Mathieu Desnoyers)
- Keep the forward movement monotonic for runqueue's cache-hot timeout value.
  (Mathieu Desnoyers, Aaron Lu)
- Introduce a new helper function cache_hot_cpu() that considers
  rq->cache_hot_timeout. (Aaron Lu)
- Add analysis of why inhibiting task migration could bring better throughput
  for some benchmarks. (Gautham R. Shenoy)
- Choose the first cache-hot CPU, if all idle CPUs are cache-hot in
  select_idle_cpu(). To avoid possible task stacking on the waker's CPU.
  (K Prateek Nayak)

Thanks for the comments and tests!

----------------------------------------------------------------------

This series aims to continue the discussion of how to make the wakee
to choose its previous CPU easier.

When task p is woken up, the scheduler leverages select_idle_sibling()
to find an idle CPU for it. p's previous CPU is usually a preference
because it can improve cache locality. However in many cases, the
previous CPU has already been taken by other wakees, thus p has to
find another idle CPU.

Inhibit the task migration could benefit many workloads. Inspired by
Mathieu's proposal to limit the task migration ratio[1], introduce
the SIS_CACHE. It considers the sleep time of the task for better
task placement. Based on the task's short sleeping history, tag p's
previous CPU as cache-hot. Later when p is woken up, it can choose
its previous CPU in select_idle_sibling(). When other task is
woken up, skip this cache-hot idle CPU and try the next idle CPU
when possible. The idea of SIS_CACHE is to optimize the idle CPU
scan sequence. The extra scan time is minimized by restricting the
scan depth of cache-hot CPUs to 50% of the scan depth of SIS_UTIL.

This test is based on tip/sched/core, on top of
Commit ada87d23b734
("x86: Fix CPUIDLE_FLAG_IRQ_ENABLE leaking timer reprogram")

This patch set has shown 15% ~ 70% improvements for client/server
workloads like netperf and tbench. It shows 0.7% improvement of
OLTP with 0.2% run-to-run variation on Xeon 240 CPUs system.
There is 2% improvement of another real life workload Daytrader
per the test of Madadi on a power system with 96 CPUs. Prateek
has helped check there is no obvious microbenchmark regression
of the v2 on a 3rd Generation EPYC System with 128 CPUs.

Link: https://lore.kernel.org/lkml/20230905171105.1005672-2-mathieu.desnoyers@efficios.com/ #1

Chen Yu (3):
  sched/fair: Record the task sleeping time as the cache hot duration
  sched/fair: Calculate the cache-hot time of the idle CPU
  sched/fair: skip the cache hot CPU in select_idle_cpu()

 include/linux/sched.h   |  4 ++
 kernel/sched/fair.c     | 88 +++++++++++++++++++++++++++++++++++++++--
 kernel/sched/features.h |  1 +
 kernel/sched/sched.h    |  1 +
 4 files changed, 91 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-19 14:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21  7:39 [PATCH v2 0/3] Introduce SIS_CACHE to choose previous CPU during task wakeup Chen Yu
2023-11-21  7:39 ` [PATCH v2 1/3] sched/fair: Record the task sleeping time as the cache hot duration Chen Yu
2023-11-21  7:39 ` [PATCH v2 2/3] sched/fair: Calculate the cache-hot time of the idle CPU Chen Yu
2023-11-21  7:40 ` [PATCH v2 3/3] sched/fair: do not scribble cache-hot CPU in select_idle_cpu() Chen Yu
2023-11-29 17:26   ` Madadi Vineeth Reddy
2023-11-30  6:43     ` Chen Yu
2023-12-01 13:56       ` Madadi Vineeth Reddy
2024-02-19 11:50   ` Hillf Danton
2024-02-19 14:24     ` Chen Yu
2023-11-25  7:10 ` [PATCH v2 2/3] sched/fair: Calculate the cache-hot time of the idle CPU Madadi Vineeth Reddy
2023-11-26  7:21   ` Chen Yu
2023-11-26  8:44 ` [PATCH v2 0/3] Introduce SIS_CACHE to choose previous CPU during task wakeup Madadi Vineeth Reddy
2023-11-26  9:25   ` Chen Yu
2024-02-18  9:27 ` Madadi Vineeth Reddy
2024-02-18 13:01   ` Chen Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox