linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] sched/fair: Choose the CPU where short task is running during wake up
@ 2022-12-01  8:43 Chen Yu
  2022-12-01  8:44 ` [PATCH v3 1/2] sched/fair: Introduce short duration task check Chen Yu
  2022-12-01  8:44 ` [PATCH v3 2/2] sched/fair: Choose the CPU where short task is running during wake up Chen Yu
  0 siblings, 2 replies; 21+ messages in thread
From: Chen Yu @ 2022-12-01  8:43 UTC (permalink / raw)
  To: Peter Zijlstra, Vincent Guittot, Tim Chen, Mel Gorman
  Cc: Juri Lelli, Rik van Riel, Aaron Lu, Abel Wu, K Prateek Nayak,
	Yicong Yang, Gautham R . Shenoy, Ingo Molnar, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Daniel Bristot de Oliveira,
	Valentin Schneider, Hillf Danton, Honglei Wang, Len Brown,
	Chen Yu, Tianchen Ding, Joel Fernandes, Josh Don, linux-kernel,
	Chen Yu

The main purpose of this change is to avoid too many cross CPU
wake up when it is unnecessary. The frequent cross CPU wake up
brings significant damage to some workloads, especially on high
core count systems.

This patch set inhibits the cross CPU wake-up by placing the wakee
on waking CPU or previous CPU, if both the waker and wakee are
short-duration tasks.

The first patch is to introduce the definition of a short-duration
task. The second patch leverages the first patch to choose a local
or previous CPU for wakee.

This version is modified based on the following feedback on v2:

1. Peter suggested comparing the duration of waker and the cost to
   scan for an idle CPU: If the cost is higher than the task duration,
   do not waste time finding an idle CPU, choose the local or previous
   CPU directly. A prototype was created based on this suggestion.
   However, according to the test result, this prototype does not inhibit
   the cross CPU wakeup and did not bring improvement. Because the cost
   to find an idle CPU is small in the problematic scenario. The root
   cause of the problem is a race condition between scanning for an idle
   CPU and task enqueue(please refer to the commit log in PATCH 2/2).
   So v3 does not change the core logic of v2, with some refinement based
   on Peter's suggestion.

2. Simplify the logic to record the task duration per Peter and Abel's suggestion.

This change brings overall improvement on some microbenchmarks, both on
Intel and AMD platforms.

v2: https://lore.kernel.org/all/cover.1666531576.git.yu.c.chen@intel.com/
v1: https://lore.kernel.org/lkml/20220915165407.1776363-1-yu.c.chen@intel.com/

Chen Yu (2):
  sched/fair: Introduce short duration task check
  sched/fair: Choose the CPU where short task is running during wake up

 include/linux/sched.h   |  4 ++++
 kernel/sched/core.c     |  2 ++
 kernel/sched/fair.c     | 27 +++++++++++++++++++++++++++
 kernel/sched/features.h |  1 +
 4 files changed, 34 insertions(+)

-- 
2.25.1


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

end of thread, other threads:[~2022-12-13 12:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01  8:43 [PATCH v3 0/2] sched/fair: Choose the CPU where short task is running during wake up Chen Yu
2022-12-01  8:44 ` [PATCH v3 1/2] sched/fair: Introduce short duration task check Chen Yu
2022-12-02  7:44   ` Honglei Wang
2022-12-03  7:49     ` Chen Yu
2022-12-03 15:35       ` Joel Fernandes
2022-12-05  8:38         ` Chen Yu
2022-12-05  9:59           ` Vincent Guittot
2022-12-05 14:38             ` Chen Yu
2022-12-07  2:23             ` Josh Don
2022-12-07 14:24               ` Chen Yu
2022-12-12 11:22                 ` Yicong Yang
2022-12-12 14:33                   ` Chen Yu
2022-12-12 18:17                     ` Josh Don
2022-12-13  5:46                       ` Chen Yu
2022-12-13 10:06                         ` Honglei Wang
2022-12-13 12:24                           ` Chen Yu
2022-12-01  8:44 ` [PATCH v3 2/2] sched/fair: Choose the CPU where short task is running during wake up Chen Yu
2022-12-05  2:36   ` Tianchen Ding
2022-12-05  8:40     ` Chen Yu
2022-12-06 13:02   ` Yicong Yang
2022-12-07  3:54     ` Chen Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).