linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sched/fair: Document the slow path and fast path in select_task_rq_fair
@ 2021-10-16 11:11 Barry Song
  2021-12-04 11:24 ` Peter Zijlstra
  2021-12-07 14:22 ` [tip: sched/core] " tip-bot2 for Barry Song
  0 siblings, 2 replies; 3+ messages in thread
From: Barry Song @ 2021-10-16 11:11 UTC (permalink / raw)
  To: bristot, bsegall, dietmar.eggemann, juri.lelli, mgorman, mingo,
	peterz, rostedt, vincent.guittot
  Cc: linux-kernel, linuxarm, yangyicong, Barry Song

From: Barry Song <song.bao.hua@hisilicon.com>

All People I know including myself took a long time to figure out
that typical wakeup will always go to fast path and never go to
slow path except WF_FORK and WF_EXEC.
Vincent reminded me once in a linaro meeting and made me understand
slow path won't happen for WF_TTWU. But my other friends repeatedly
wasted a lot of time on testing this path like me before I reminded
them.
So obviously the code needs some document.

Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 -v2: refine according to Steven's comments, thanks!

 kernel/sched/fair.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f6a05d9b5443..816c8ddf1b6d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6951,6 +6951,11 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
 			break;
 		}
 
+		/*
+		 * Usually only true for WF_EXEC and WF_FORK, as sched_domains
+		 * usually do not have SD_BALANCE_WAKE set. That means wakeup
+		 * will usually go to the fast path.
+		 */
 		if (tmp->flags & sd_flag)
 			sd = tmp;
 		else if (!want_affine)
-- 
2.25.1


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

* Re: [PATCH v2] sched/fair: Document the slow path and fast path in select_task_rq_fair
  2021-10-16 11:11 [PATCH v2] sched/fair: Document the slow path and fast path in select_task_rq_fair Barry Song
@ 2021-12-04 11:24 ` Peter Zijlstra
  2021-12-07 14:22 ` [tip: sched/core] " tip-bot2 for Barry Song
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2021-12-04 11:24 UTC (permalink / raw)
  To: Barry Song
  Cc: bristot, bsegall, dietmar.eggemann, juri.lelli, mgorman, mingo,
	rostedt, vincent.guittot, linux-kernel, linuxarm, yangyicong,
	Barry Song

On Sat, Oct 16, 2021 at 07:11:09PM +0800, Barry Song wrote:
> From: Barry Song <song.bao.hua@hisilicon.com>
> 
> All People I know including myself took a long time to figure out
> that typical wakeup will always go to fast path and never go to
> slow path except WF_FORK and WF_EXEC.
> Vincent reminded me once in a linaro meeting and made me understand
> slow path won't happen for WF_TTWU. But my other friends repeatedly
> wasted a lot of time on testing this path like me before I reminded
> them.
> So obviously the code needs some document.
> 
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> ---

Thanks!

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

* [tip: sched/core] sched/fair: Document the slow path and fast path in select_task_rq_fair
  2021-10-16 11:11 [PATCH v2] sched/fair: Document the slow path and fast path in select_task_rq_fair Barry Song
  2021-12-04 11:24 ` Peter Zijlstra
@ 2021-12-07 14:22 ` tip-bot2 for Barry Song
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Barry Song @ 2021-12-07 14:22 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Barry Song, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     2917406c352757642c3c1a13a4c99c96e6d22fde
Gitweb:        https://git.kernel.org/tip/2917406c352757642c3c1a13a4c99c96e6d22fde
Author:        Barry Song <song.bao.hua@hisilicon.com>
AuthorDate:    Sat, 16 Oct 2021 19:11:09 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 07 Dec 2021 15:14:10 +01:00

sched/fair: Document the slow path and fast path in select_task_rq_fair

All People I know including myself took a long time to figure out that
typical wakeup will always go to fast path and never go to slow path
except WF_FORK and WF_EXEC.

Vincent reminded me once in a linaro meeting and made me understand
slow path won't happen for WF_TTWU. But my other friends repeatedly
wasted a lot of time on testing this path like me before I reminded
them.

So obviously the code needs some document.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211016111109.5559-1-21cnbao@gmail.com
---
 kernel/sched/fair.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0672218..f34f2f3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6917,6 +6917,11 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
 			break;
 		}
 
+		/*
+		 * Usually only true for WF_EXEC and WF_FORK, as sched_domains
+		 * usually do not have SD_BALANCE_WAKE set. That means wakeup
+		 * will usually go to the fast path.
+		 */
 		if (tmp->flags & sd_flag)
 			sd = tmp;
 		else if (!want_affine)

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

end of thread, other threads:[~2021-12-07 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 11:11 [PATCH v2] sched/fair: Document the slow path and fast path in select_task_rq_fair Barry Song
2021-12-04 11:24 ` Peter Zijlstra
2021-12-07 14:22 ` [tip: sched/core] " tip-bot2 for Barry Song

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).