[PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI

K Prateek Nayak posted 5 patches 2 weeks ago
[PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI
Posted by K Prateek Nayak 2 weeks ago
commit 1a6151017ee5 ("sched: psi: pass enqueue/dequeue flags to psi
callbacks directly") modified the psi_enqueue() and psi_dequeue()
functions to take the complete enqueue/dequeue flags but left the stubs
for !CONFIG_PSI unaltered.

Modify the stubs to also accept the flags argument to keep it consistent
with CONFIG_PSI.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
 kernel/sched/stats.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
index cbf7206b3f9d..3323d773fec3 100644
--- a/kernel/sched/stats.h
+++ b/kernel/sched/stats.h
@@ -221,8 +221,8 @@ static inline void psi_sched_switch(struct task_struct *prev,
 }
 
 #else /* !CONFIG_PSI: */
-static inline void psi_enqueue(struct task_struct *p, bool migrate) {}
-static inline void psi_dequeue(struct task_struct *p, bool migrate) {}
+static inline void psi_enqueue(struct task_struct *p, int flags) {}
+static inline void psi_dequeue(struct task_struct *p, int flags) {}
 static inline void psi_ttwu_dequeue(struct task_struct *p) {}
 static inline void psi_sched_switch(struct task_struct *prev,
 				    struct task_struct *next,
-- 
2.34.1
Re: [PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI
Posted by Madadi Vineeth Reddy 1 week, 4 days ago
On 18/11/25 00:25, K Prateek Nayak wrote:
> commit 1a6151017ee5 ("sched: psi: pass enqueue/dequeue flags to psi
> callbacks directly") modified the psi_enqueue() and psi_dequeue()
> functions to take the complete enqueue/dequeue flags but left the stubs
> for !CONFIG_PSI unaltered.
> 
> Modify the stubs to also accept the flags argument to keep it consistent
> with CONFIG_PSI.
> 
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
> ---
>  kernel/sched/stats.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
> index cbf7206b3f9d..3323d773fec3 100644
> --- a/kernel/sched/stats.h
> +++ b/kernel/sched/stats.h
> @@ -221,8 +221,8 @@ static inline void psi_sched_switch(struct task_struct *prev,
>  }
>  
>  #else /* !CONFIG_PSI: */
> -static inline void psi_enqueue(struct task_struct *p, bool migrate) {}
> -static inline void psi_dequeue(struct task_struct *p, bool migrate) {}
> +static inline void psi_enqueue(struct task_struct *p, int flags) {}
> +static inline void psi_dequeue(struct task_struct *p, int flags) {}
>  static inline void psi_ttwu_dequeue(struct task_struct *p) {}
>  static inline void psi_sched_switch(struct task_struct *prev,
>  				    struct task_struct *next,

Right. The commit that updated the function signature did not update the
!CONFIG_PSI stubs accordingly. This patch corrects that.

Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>

Thanks,
Vineeth
Re: [PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI
Posted by K Prateek Nayak 1 week, 4 days ago
Hello Vineeth,

On 11/20/2025 11:29 AM, Madadi Vineeth Reddy wrote:
> On 18/11/25 00:25, K Prateek Nayak wrote:
>> commit 1a6151017ee5 ("sched: psi: pass enqueue/dequeue flags to psi
>> callbacks directly") modified the psi_enqueue() and psi_dequeue()
>> functions to take the complete enqueue/dequeue flags but left the stubs
>> for !CONFIG_PSI unaltered.
>>
>> Modify the stubs to also accept the flags argument to keep it consistent
>> with CONFIG_PSI.
>>
>> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
>> ---
>>  kernel/sched/stats.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
>> index cbf7206b3f9d..3323d773fec3 100644
>> --- a/kernel/sched/stats.h
>> +++ b/kernel/sched/stats.h
>> @@ -221,8 +221,8 @@ static inline void psi_sched_switch(struct task_struct *prev,
>>  }
>>  
>>  #else /* !CONFIG_PSI: */
>> -static inline void psi_enqueue(struct task_struct *p, bool migrate) {}
>> -static inline void psi_dequeue(struct task_struct *p, bool migrate) {}
>> +static inline void psi_enqueue(struct task_struct *p, int flags) {}
>> +static inline void psi_dequeue(struct task_struct *p, int flags) {}
>>  static inline void psi_ttwu_dequeue(struct task_struct *p) {}
>>  static inline void psi_sched_switch(struct task_struct *prev,
>>  				    struct task_struct *next,
> 
> Right. The commit that updated the function signature did not update the
> !CONFIG_PSI stubs accordingly. This patch corrects that.
> 
> Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>

Thanks for the review.

P.S. John has an alternate fix for the same at
https://lore.kernel.org/lkml/20251118055242.4030849-1-jstultz@google.com/

That considers a blocked donor as a runnable entity from PSI
standpoint.

This series implements the alternate approach of blocking the PSI signals
when the blocked donor is retained on the rq, skipping the block_task()
and it enqueues the PSI signal back when the donor is woken up again.

-- 
Thanks and Regards,
Prateek
Re: [PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI
Posted by Madadi Vineeth Reddy 1 week, 4 days ago
Hi Prateek,

On 20/11/25 11:40, K Prateek Nayak wrote:
> Hello Vineeth,
> 
> On 11/20/2025 11:29 AM, Madadi Vineeth Reddy wrote:
>> On 18/11/25 00:25, K Prateek Nayak wrote:
>>> commit 1a6151017ee5 ("sched: psi: pass enqueue/dequeue flags to psi
>>> callbacks directly") modified the psi_enqueue() and psi_dequeue()
>>> functions to take the complete enqueue/dequeue flags but left the stubs
>>> for !CONFIG_PSI unaltered.
>>>
>>> Modify the stubs to also accept the flags argument to keep it consistent
>>> with CONFIG_PSI.
>>>
>>> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
>>> ---
>>>  kernel/sched/stats.h | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
>>> index cbf7206b3f9d..3323d773fec3 100644
>>> --- a/kernel/sched/stats.h
>>> +++ b/kernel/sched/stats.h
>>> @@ -221,8 +221,8 @@ static inline void psi_sched_switch(struct task_struct *prev,
>>>  }
>>>  
>>>  #else /* !CONFIG_PSI: */
>>> -static inline void psi_enqueue(struct task_struct *p, bool migrate) {}
>>> -static inline void psi_dequeue(struct task_struct *p, bool migrate) {}
>>> +static inline void psi_enqueue(struct task_struct *p, int flags) {}
>>> +static inline void psi_dequeue(struct task_struct *p, int flags) {}
>>>  static inline void psi_ttwu_dequeue(struct task_struct *p) {}
>>>  static inline void psi_sched_switch(struct task_struct *prev,
>>>  				    struct task_struct *next,
>>
>> Right. The commit that updated the function signature did not update the
>> !CONFIG_PSI stubs accordingly. This patch corrects that.
>>
>> Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
> 
> Thanks for the review.
> 
> P.S. John has an alternate fix for the same at
> https://lore.kernel.org/lkml/20251118055242.4030849-1-jstultz@google.com/

Thanks for pointing this out. While going through the discussion I had seen it
in John's tree, but I hadn't realized it was already posted upstream.

I gave the Reviewed-by since the first two cleanup patches still seem valid
and can go in independently of that alternate fix.

Thanks,
Vineeth

> 
> That considers a blocked donor as a runnable entity from PSI
> standpoint.
> 
> This series implements the alternate approach of blocking the PSI signals
> when the blocked donor is retained on the rq, skipping the block_task()
> and it enqueues the PSI signal back when the donor is woken up again.
>
Re: [PATCH 1/5] sched/psi: Make psi stubs consistent for !CONFIG_PSI
Posted by John Stultz 2 weeks ago
On Mon, Nov 17, 2025 at 10:56 AM K Prateek Nayak <kprateek.nayak@amd.com> wrote:
>
> commit 1a6151017ee5 ("sched: psi: pass enqueue/dequeue flags to psi
> callbacks directly") modified the psi_enqueue() and psi_dequeue()
> functions to take the complete enqueue/dequeue flags but left the stubs
> for !CONFIG_PSI unaltered.
>
> Modify the stubs to also accept the flags argument to keep it consistent
> with CONFIG_PSI.
>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>

I'm not super deep in the PSI logic, but this looks obviously correct.
Thanks for cleaning this up.
Reviewed-by: John Stultz <jstultz@google.com>