lkml.org 
[lkml]   [2022]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 5/5] sched/fair: favor cpu capacity for idle tasks
Date
Unlike select_idle_sibling() in which we need to find a
not-so-bad candidate ASAP, the slowpath gives us more
tolerance: ignore sched-idle cpus for idle tasks since
they prefer cpu capacity rather than latency, and besides
spreading out idle tasks also good for latency of normal
tasks.

Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
---
kernel/sched/fair.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1d8f396e6f41..57f1d8c43228 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6007,6 +6007,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu);
static int
find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
{
+ bool ignore_si = task_h_idle(p);
unsigned long load, min_load = ULONG_MAX;
unsigned int min_exit_latency = UINT_MAX;
u64 latest_idle_timestamp = 0;
@@ -6025,7 +6026,13 @@ find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this
if (!sched_core_cookie_match(rq, p))
continue;

- if (sched_idle_cpu(i))
+ /*
+ * The idle tasks prefer cpu capacity rather than
+ * latency. Spreading out idle tasks also good for
+ * latency of normal tasks since they won't suffer
+ * high cpu wakeup delay.
+ */
+ if (!ignore_si && sched_idle_cpu(i))
return i;

if (available_idle_cpu(i)) {
--
2.11.0
\
 
 \ /
  Last update: 2022-02-17 16:45    [W:0.186 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site