All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: fair: don't depend on wake_wide if waker and wakee are already in same LLC
@ 2021-05-26  9:10 Barry Song
  2021-05-26 12:15 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Barry Song @ 2021-05-26  9:10 UTC (permalink / raw)
  To: vincent.guittot, mingo, peterz, dietmar.eggemann, rostedt,
	bsegall, mgorman
  Cc: valentin.schneider, juri.lelli, bristot, linux-kernel,
	guodong.xu, yangyicong, tangchengchang, linuxarm, Barry Song

when waker and wakee are already in the same LLC, it is pointless to worry
about the competition caused by pulling wakee to waker's LLC domain.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 kernel/sched/fair.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3248e24a90b0..cfb1bd47acc3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6795,7 +6795,15 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
 			new_cpu = prev_cpu;
 		}
 
-		want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr);
+		/*
+		 * we use wake_wide to make smarter pull and avoid cruel
+		 * competition because of jam-packed tasks in waker's LLC
+		 * domain. But if waker and wakee have been already in
+		 * same LLC domain, it seems it is pointless to depend
+		 * on wake_wide
+		 */
+		want_affine = (cpus_share_cache(cpu, prev_cpu) || !wake_wide(p)) &&
+				cpumask_test_cpu(cpu, p->cpus_ptr);
 	}
 
 	rcu_read_lock();
-- 
2.25.1


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

end of thread, other threads:[~2021-06-01  8:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26  9:10 [PATCH] sched: fair: don't depend on wake_wide if waker and wakee are already in same LLC Barry Song
2021-05-26 12:15 ` Peter Zijlstra
2021-05-26 21:38   ` Song Bao Hua (Barry Song)
2021-05-27 12:14     ` Mel Gorman
2021-05-31 22:21       ` Song Bao Hua (Barry Song)
2021-06-01  7:59         ` Mel Gorman
2021-06-01  8:09           ` Song Bao Hua (Barry Song)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.