Re: [PATCH 3/3] sched/core: Indicate a sched_delayed task was migrated before wakeup

From: K Prateek Nayak
Date: Mon Oct 14 2024 - 23:11:54 EST


Hello Johannes,

On 10/14/2024 8:13 PM, Johannes Weiner wrote:
On Fri, Oct 11, 2024 at 12:39:58PM +0200, Peter Zijlstra wrote:
On Fri, Oct 11, 2024 at 06:08:03AM -0400, Johannes Weiner wrote:
Completely untested. But if it looks good, I'll send a proper patch.

Sure. Thanks for doing this.

Ok here goes. Built, booted and runtime-tested.

---

From 91f230caa0119877cb861047e1af1371bf00d908 Mon Sep 17 00:00:00 2001
From: Johannes Weiner <hannes@xxxxxxxxxxx>
Date: Fri, 11 Oct 2024 06:18:07 -0400
Subject: [PATCH] sched: psi: pass enqueue/dequeue flags to psi callbacks
directly

What psi needs to do on each enqueue and dequeue has gotten more
subtle, and the generic sched code trying to distill this into a bool
for the callbacks is awkward.

Pass the flags directly and let psi parse them. For that to work, the
#include "stats.h" (which has the psi callback implementations) needs
to be below the flag definitions in "sched.h". Move that section
further down, next to some of the other accounting stuff.

This also puts the ENQUEUE_SAVE/RESTORE branch behind the psi jump
label, slightly reducing overhead when PSI=y but runtime disabled.

Link: https://lore.kernel.org/lkml/20241011083323.GL17263@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>

I tested this series on top of tip:sched/urgent at commit cd9626e9ebc7
("sched/fair: Fix external p->on_rq users") and did not observe any
splats related to PSI or otherwise. Please feel free to add:

Tested-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>

--
Thanks and Regards,
Prateek

---
kernel/sched/core.c | 12 +++++-----
kernel/sched/sched.h | 56 ++++++++++++++++++++++----------------------
kernel/sched/stats.h | 29 +++++++++++++++--------
3 files changed, 53 insertions(+), 44 deletions(-)

[..snip..]