All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/debug: Fix requested task uclamp values shown in procfs
@ 2020-05-10 12:56 Pavankumar Kondeti
  2020-05-10 16:16 ` Valentin Schneider
  2020-05-19 18:44 ` [tip: sched/urgent] " tip-bot2 for Pavankumar Kondeti
  0 siblings, 2 replies; 4+ messages in thread
From: Pavankumar Kondeti @ 2020-05-10 12:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavankumar Kondeti, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Qais Yousef, Valentin Schneider

The intention of commit 96e74ebf8d59 ("sched/debug: Add task uclamp
values to SCHED_DEBUG procfs") was to print requested and effective
task uclamp values. The requested values printed are read from p->uclamp,
which holds the last effective values. Fix this by printing the values
from p->uclamp_req.

Fixes: 96e74ebf8d59 ("sched/debug: Add task uclamp values to SCHED_DEBUG procfs")
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
---
 kernel/sched/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index a562df5..239970b 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	P(se.avg.util_est.enqueued);
 #endif
 #ifdef CONFIG_UCLAMP_TASK
-	__PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
-	__PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
+	__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
+	__PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);
 	__PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
 	__PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
 #endif
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [PATCH] sched/debug: Fix requested task uclamp values shown in procfs
  2020-05-10 12:56 [PATCH] sched/debug: Fix requested task uclamp values shown in procfs Pavankumar Kondeti
@ 2020-05-10 16:16 ` Valentin Schneider
  2020-05-11  1:55   ` Pavan Kondeti
  2020-05-19 18:44 ` [tip: sched/urgent] " tip-bot2 for Pavankumar Kondeti
  1 sibling, 1 reply; 4+ messages in thread
From: Valentin Schneider @ 2020-05-10 16:16 UTC (permalink / raw)
  To: Pavankumar Kondeti
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Qais Yousef


On 10/05/20 13:56, Pavankumar Kondeti wrote:
> The intention of commit 96e74ebf8d59 ("sched/debug: Add task uclamp
> values to SCHED_DEBUG procfs") was to print requested and effective
> task uclamp values. The requested values printed are read from p->uclamp,
> which holds the last effective values. Fix this by printing the values
> from p->uclamp_req.
>
> Fixes: 96e74ebf8d59 ("sched/debug: Add task uclamp values to SCHED_DEBUG procfs")
> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Argh, Qais pointed this out to me ~ a week ago, and I left this in my todo
stack. I goofed up, sorry!

As Pavan points out, p->uclamp[foo] is just a cache of uclamp_eff_value(p,
foo) from the last time p was enqueued and runnable - what we are
interested in is indeed comparing this with the *requested* value.

I wanted to send an example along with a patch, I guess that's the kick I
needed!


My setup is a busy loop, its per-task clamps are set to (256, 768) via
sched_setattr(), and it's shoved in a cpu cgroup with uclamp settings of
(50%, 50%)

On the current master (e99332e7b4cd ("gcc-10: mark more functions __init to
avoid section mismatch warnings")), this gives me:

  $ uclamp-get $PID # via sched_getattr()
  uclamp.min=256 uclamp.max=768

  $ cat /proc/$PID/sched | grep uclamp
  uclamp.min                                   :                  256
  uclamp.max                                   :                  512
  effective uclamp.min                         :                  256
  effective uclamp.max                         :                  512

With Pavan's patch, I get:

  $ uclamp-get $PID # via sched_getattr()
  uclamp.min=256 uclamp.max=768

  $ cat /proc/$PID/sched | grep uclamp
  uclamp.min                                   :                  256
  uclamp.max                                   :                  768
  effective uclamp.min                         :                  256
  effective uclamp.max                         :                  512


Minor print nit below, otherwise:
Tested-and-reviewed-by: Valentin Schneider <valentin.schneider@arm.com>

Peter/Ingo, any chance this can go to sched/urgent? I know it's a debug
interface, but I'd rather have it land in a shape that makes sense. Again,
apologies for the goof.

> ---
>  kernel/sched/debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index a562df5..239970b 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
>       P(se.avg.util_est.enqueued);
>  #endif
>  #ifdef CONFIG_UCLAMP_TASK
> -	__PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
> -	__PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
> +	__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
> +	__PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);

While we're at it, I'd prepend this with "requested".

>       __PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
>       __PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
>  #endif

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

* Re: [PATCH] sched/debug: Fix requested task uclamp values shown in procfs
  2020-05-10 16:16 ` Valentin Schneider
@ 2020-05-11  1:55   ` Pavan Kondeti
  0 siblings, 0 replies; 4+ messages in thread
From: Pavan Kondeti @ 2020-05-11  1:55 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Qais Yousef

On Sun, May 10, 2020 at 05:16:28PM +0100, Valentin Schneider wrote:
> 
> On 10/05/20 13:56, Pavankumar Kondeti wrote:
> > The intention of commit 96e74ebf8d59 ("sched/debug: Add task uclamp
> > values to SCHED_DEBUG procfs") was to print requested and effective
> > task uclamp values. The requested values printed are read from p->uclamp,
> > which holds the last effective values. Fix this by printing the values
> > from p->uclamp_req.
> >
> > Fixes: 96e74ebf8d59 ("sched/debug: Add task uclamp values to SCHED_DEBUG procfs")
> > Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
> 
> Argh, Qais pointed this out to me ~ a week ago, and I left this in my todo
> stack. I goofed up, sorry!
> 
> As Pavan points out, p->uclamp[foo] is just a cache of uclamp_eff_value(p,
> foo) from the last time p was enqueued and runnable - what we are
> interested in is indeed comparing this with the *requested* value.
> 
> I wanted to send an example along with a patch, I guess that's the kick I
> needed!
> 
> 
> My setup is a busy loop, its per-task clamps are set to (256, 768) via
> sched_setattr(), and it's shoved in a cpu cgroup with uclamp settings of
> (50%, 50%)
> 
> On the current master (e99332e7b4cd ("gcc-10: mark more functions __init to
> avoid section mismatch warnings")), this gives me:
> 
>   $ uclamp-get $PID # via sched_getattr()
>   uclamp.min=256 uclamp.max=768
> 
>   $ cat /proc/$PID/sched | grep uclamp
>   uclamp.min                                   :                  256
>   uclamp.max                                   :                  512
>   effective uclamp.min                         :                  256
>   effective uclamp.max                         :                  512
> 
> With Pavan's patch, I get:
> 
>   $ uclamp-get $PID # via sched_getattr()
>   uclamp.min=256 uclamp.max=768
> 
>   $ cat /proc/$PID/sched | grep uclamp
>   uclamp.min                                   :                  256
>   uclamp.max                                   :                  768
>   effective uclamp.min                         :                  256
>   effective uclamp.max                         :                  512
> 
> 
> Minor print nit below, otherwise:
> Tested-and-reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
> 
> Peter/Ingo, any chance this can go to sched/urgent? I know it's a debug
> interface, but I'd rather have it land in a shape that makes sense. Again,
> apologies for the goof.
> 
> > ---
> >  kernel/sched/debug.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> > index a562df5..239970b 100644
> > --- a/kernel/sched/debug.c
> > +++ b/kernel/sched/debug.c
> > @@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
> >       P(se.avg.util_est.enqueued);
> >  #endif
> >  #ifdef CONFIG_UCLAMP_TASK
> > -	__PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
> > -	__PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
> > +	__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
> > +	__PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);
> 
> While we're at it, I'd prepend this with "requested".
> 
> >       __PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
> >       __PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
> >  #endif

Thanks Valentin for taking a look. I have added "requested" prefix and sent
the patch.

Thanks,
Pavan

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* [tip: sched/urgent] sched/debug: Fix requested task uclamp values shown in procfs
  2020-05-10 12:56 [PATCH] sched/debug: Fix requested task uclamp values shown in procfs Pavankumar Kondeti
  2020-05-10 16:16 ` Valentin Schneider
@ 2020-05-19 18:44 ` tip-bot2 for Pavankumar Kondeti
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Pavankumar Kondeti @ 2020-05-19 18:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Pavankumar Kondeti, Peter Zijlstra (Intel),
	Valentin Schneider, x86, LKML

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

Commit-ID:     ad32bb41fca67936c0c1d6d0bdd6d3e2e9c5432f
Gitweb:        https://git.kernel.org/tip/ad32bb41fca67936c0c1d6d0bdd6d3e2e9c5432f
Author:        Pavankumar Kondeti <pkondeti@codeaurora.org>
AuthorDate:    Sun, 10 May 2020 18:26:41 +05:30
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 19 May 2020 20:34:10 +02:00

sched/debug: Fix requested task uclamp values shown in procfs

The intention of commit 96e74ebf8d59 ("sched/debug: Add task uclamp
values to SCHED_DEBUG procfs") was to print requested and effective
task uclamp values. The requested values printed are read from p->uclamp,
which holds the last effective values. Fix this by printing the values
from p->uclamp_req.

Fixes: 96e74ebf8d59 ("sched/debug: Add task uclamp values to SCHED_DEBUG procfs")
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/1589115401-26391-1-git-send-email-pkondeti@codeaurora.org
---
 kernel/sched/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index a562df5..239970b 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	P(se.avg.util_est.enqueued);
 #endif
 #ifdef CONFIG_UCLAMP_TASK
-	__PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
-	__PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
+	__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
+	__PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);
 	__PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
 	__PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
 #endif

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

end of thread, other threads:[~2020-05-19 18:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 12:56 [PATCH] sched/debug: Fix requested task uclamp values shown in procfs Pavankumar Kondeti
2020-05-10 16:16 ` Valentin Schneider
2020-05-11  1:55   ` Pavan Kondeti
2020-05-19 18:44 ` [tip: sched/urgent] " tip-bot2 for Pavankumar Kondeti

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.