linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
@ 2016-10-24 22:32 Tommaso Cucinotta
  2016-10-24 22:32 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tommaso Cucinotta @ 2016-10-24 22:32 UTC (permalink / raw)
  To: Luca Abeni, Juri Lelli, Peter Zijlstra
  Cc: linux-kernel, linux-dl, Tommaso Cucinotta, Daniel Bistrot de Oliveira

Hi all,

this is a tiny patch providing readings of the current (leftover)
runtime and absolute deadline in /proc/*/sched. Mostly useful for
debugging, I heard others playing with SCHED_DEADLINE had some need
for similar patches as well.

In addition to debugging, reading the leftover runtime is generally
useful for adaptive/incremental RT logics that need to check whether
there's enough runtime left for refining the computed result, or just
use what we've computed so far and block till the next instance.
Also, knowing what the absolute scheduling deadline is (along with
what clock it refers to) might be useful for synchronization purposes.
(albeit, for real production code, I wouldn't like to parse /proc anyway,
rather I'd prefer to retrieve those params via eg sched_getscheduler()?)

Please, share your thoughts, thanks.

  Tommaso

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

* [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched
  2016-10-24 22:32 [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta
@ 2016-10-24 22:32 ` Tommaso Cucinotta
  2016-10-25  9:39   ` Juri Lelli
  2016-10-25  9:25 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Peter Zijlstra
  2016-10-26  9:17 ` [PATCH] " Tommaso Cucinotta
  2 siblings, 1 reply; 10+ messages in thread
From: Tommaso Cucinotta @ 2016-10-24 22:32 UTC (permalink / raw)
  To: Luca Abeni, Juri Lelli, Peter Zijlstra
  Cc: linux-kernel, linux-dl, Tommaso Cucinotta,
	Daniel Bistrot de Oliveira, Tommaso Cucinotta

From: Tommaso Cucinotta <tommaso@lyx.org>

---
 kernel/sched/debug.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index fa178b6..109adc0 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -953,6 +953,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 #endif
 	P(policy);
 	P(prio);
+	if (p->policy == SCHED_DEADLINE) {
+		P(dl.runtime);
+		P(dl.deadline);
+	}
 #undef PN_SCHEDSTAT
 #undef PN
 #undef __PN
-- 
2.7.4

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

* Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
  2016-10-24 22:32 [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta
  2016-10-24 22:32 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
@ 2016-10-25  9:25 ` Peter Zijlstra
  2016-10-25  9:33   ` Juri Lelli
  2016-10-26  9:17 ` [PATCH] " Tommaso Cucinotta
  2 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2016-10-25  9:25 UTC (permalink / raw)
  To: Tommaso Cucinotta
  Cc: Luca Abeni, Juri Lelli, linux-kernel, linux-dl,
	Daniel Bistrot de Oliveira, Ingo Molnar

On Tue, Oct 25, 2016 at 12:32:53AM +0200, Tommaso Cucinotta wrote:
> Hi all,
> 
> this is a tiny patch providing readings of the current (leftover)
> runtime and absolute deadline in /proc/*/sched. Mostly useful for
> debugging, I heard others playing with SCHED_DEADLINE had some need
> for similar patches as well.
> 
> In addition to debugging, reading the leftover runtime is generally
> useful for adaptive/incremental RT logics that need to check whether
> there's enough runtime left for refining the computed result, or just
> use what we've computed so far and block till the next instance.
> Also, knowing what the absolute scheduling deadline is (along with
> what clock it refers to) might be useful for synchronization purposes.
> (albeit, for real production code, I wouldn't like to parse /proc anyway,
> rather I'd prefer to retrieve those params via eg sched_getscheduler()?)

So for programmatic use, this interface is not recommended. For
debugging this is fine.

Not sure what form the programmatic interface should take, we have
precedence in sys_sched_rr_get_interval() for a syscall (we could even
abuse this one).

Anybody any ideas?

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

* Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
  2016-10-25  9:25 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Peter Zijlstra
@ 2016-10-25  9:33   ` Juri Lelli
  2016-10-25 10:10     ` luca abeni
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Lelli @ 2016-10-25  9:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Tommaso Cucinotta, Luca Abeni, Juri Lelli, linux-kernel,
	Daniel Bistrot de Oliveira, Ingo Molnar

On 25/10/16 11:25, Peter Zijlstra wrote:
> On Tue, Oct 25, 2016 at 12:32:53AM +0200, Tommaso Cucinotta wrote:
> > Hi all,
> > 
> > this is a tiny patch providing readings of the current (leftover)
> > runtime and absolute deadline in /proc/*/sched. Mostly useful for
> > debugging, I heard others playing with SCHED_DEADLINE had some need
> > for similar patches as well.
> > 
> > In addition to debugging, reading the leftover runtime is generally
> > useful for adaptive/incremental RT logics that need to check whether
> > there's enough runtime left for refining the computed result, or just
> > use what we've computed so far and block till the next instance.
> > Also, knowing what the absolute scheduling deadline is (along with
> > what clock it refers to) might be useful for synchronization purposes.
> > (albeit, for real production code, I wouldn't like to parse /proc anyway,
> > rather I'd prefer to retrieve those params via eg sched_getscheduler()?)
> 
> So for programmatic use, this interface is not recommended. For
> debugging this is fine.
> 
> Not sure what form the programmatic interface should take, we have
> precedence in sys_sched_rr_get_interval() for a syscall (we could even
> abuse this one).
> 
> Anybody any ideas?
> 

Maybe extend getattr() to return actual runtime params? (instead of the
static ones, or along to them)

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

* Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched
  2016-10-24 22:32 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
@ 2016-10-25  9:39   ` Juri Lelli
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Lelli @ 2016-10-25  9:39 UTC (permalink / raw)
  To: Tommaso Cucinotta
  Cc: Luca Abeni, Juri Lelli, Peter Zijlstra, linux-kernel,
	Daniel Bistrot de Oliveira, Tommaso Cucinotta

Hi,

On 25/10/16 00:32, Tommaso Cucinotta wrote:
> From: Tommaso Cucinotta <tommaso@lyx.org>

You should probably commit from your sssup address?

Also changelog is missing. You can simply put here part of your cover
letter wordings.

> 
> ---
>  kernel/sched/debug.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index fa178b6..109adc0 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -953,6 +953,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
>  #endif
>  	P(policy);
>  	P(prio);
> +	if (p->policy == SCHED_DEADLINE) {
> +		P(dl.runtime);
> +		P(dl.deadline);
> +	}

For testing purposes looks ok to me.

Best,

- Juri

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

* Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
  2016-10-25  9:33   ` Juri Lelli
@ 2016-10-25 10:10     ` luca abeni
  2016-10-25 11:31       ` Daniel Bristot de Oliveira
  0 siblings, 1 reply; 10+ messages in thread
From: luca abeni @ 2016-10-25 10:10 UTC (permalink / raw)
  To: Juri Lelli
  Cc: Peter Zijlstra, Tommaso Cucinotta, Juri Lelli, linux-kernel,
	Daniel Bistrot de Oliveira, Ingo Molnar

On Tue, 25 Oct 2016 10:33:21 +0100
Juri Lelli <juri.lelli@arm.com> wrote:

> On 25/10/16 11:25, Peter Zijlstra wrote:
> > On Tue, Oct 25, 2016 at 12:32:53AM +0200, Tommaso Cucinotta wrote:  
> > > Hi all,
> > > 
> > > this is a tiny patch providing readings of the current (leftover)
> > > runtime and absolute deadline in /proc/*/sched. Mostly useful for
> > > debugging, I heard others playing with SCHED_DEADLINE had some
> > > need for similar patches as well.
> > > 
> > > In addition to debugging, reading the leftover runtime is
> > > generally useful for adaptive/incremental RT logics that need to
> > > check whether there's enough runtime left for refining the
> > > computed result, or just use what we've computed so far and block
> > > till the next instance. Also, knowing what the absolute
> > > scheduling deadline is (along with what clock it refers to) might
> > > be useful for synchronization purposes. (albeit, for real
> > > production code, I wouldn't like to parse /proc anyway, rather
> > > I'd prefer to retrieve those params via eg
> > > sched_getscheduler()?)  
> > 
> > So for programmatic use, this interface is not recommended. For
> > debugging this is fine.
> > 
> > Not sure what form the programmatic interface should take, we have
> > precedence in sys_sched_rr_get_interval() for a syscall (we could
> > even abuse this one).
> > 
> > Anybody any ideas?
> >   
> 
> Maybe extend getattr() to return actual runtime params? (instead of
> the static ones, or along to them)

This is similar to what I did in the past: I used (or maybe abused?)
the "flags" argument of getattr() to tell it if I wanted it to return
the current runtime and scheduling deadline, or the maximum runtime and
relative deadline.

I think that both the "/proc based" interface proposed by Tommaso and
the syscall-based one are useful (for different purposes).


				Luca

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

* Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
  2016-10-25 10:10     ` luca abeni
@ 2016-10-25 11:31       ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-10-25 11:31 UTC (permalink / raw)
  To: luca abeni, Juri Lelli
  Cc: Peter Zijlstra, Tommaso Cucinotta, Juri Lelli, linux-kernel,
	Daniel Bistrot de Oliveira, Ingo Molnar

Il 25/10/2016 12:10, luca abeni ha scritto:
> I think that both the "/proc based" interface proposed by Tommaso and
> the syscall-based one are useful (for different purposes).

+1

-- Daniel

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

* [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
  2016-10-24 22:32 [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta
  2016-10-24 22:32 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
  2016-10-25  9:25 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Peter Zijlstra
@ 2016-10-26  9:17 ` Tommaso Cucinotta
  2016-10-26  9:17   ` [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
  2 siblings, 1 reply; 10+ messages in thread
From: Tommaso Cucinotta @ 2016-10-26  9:17 UTC (permalink / raw)
  To: Luca Abeni, Juri Lelli, Peter Zijlstra, Ingo Molnar
  Cc: linux-kernel, Tommaso Cucinotta, Daniel Bistrot de Oliveira

This patch allows for reading the current (leftover) runtime and
absolute deadline in /proc/*/sched, for debugging purposes.

This revised patch:
1) has a fixed format, Signed-off-by, etc., as suggested by Juri
2) now includes related docs in Documentation/
3) now I'm sending these e-mails with the correct From:

[PATCH] sched/deadline: show leftover runtime and abs deadline in

Thanks,

  T.
--
Hi all,

this is a tiny patch providing readings of the current (leftover)
runtime and absolute deadline in /proc/*/sched. Mostly useful for
debugging, I heard others playing with SCHED_DEADLINE had some need
for similar patches as well.

In addition to debugging, reading the leftover runtime is generally
useful for adaptive/incremental RT logics that need to check whether
there's enough runtime left for refining the computed result, or just
use what we've computed so far and block till the next instance.
Also, knowing what the absolute scheduling deadline is (along with
what clock it refers to) might be useful for synchronization purposes.
(albeit, for real production code, I wouldn't like to parse /proc anyway,
rather I'd prefer to retrieve those params via eg sched_getscheduler()?)

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

* [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched
  2016-10-26  9:17 ` [PATCH] " Tommaso Cucinotta
@ 2016-10-26  9:17   ` Tommaso Cucinotta
  2017-01-14 12:47     ` [tip:sched/core] sched/deadline: Show " tip-bot for Tommaso Cucinotta
  0 siblings, 1 reply; 10+ messages in thread
From: Tommaso Cucinotta @ 2016-10-26  9:17 UTC (permalink / raw)
  To: Luca Abeni, Juri Lelli, Peter Zijlstra, Ingo Molnar
  Cc: linux-kernel, Tommaso Cucinotta, Daniel Bistrot de Oliveira, Ingo Molnar

This patch allows for reading the current (leftover) runtime and
absolute deadline of a SCHED_DEADLINE task through /proc/*/sched
(entries dl.runtime and dl.deadline), while debugging/testing.

Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Luca Abeni <luca.abeni@unitn.it>
Acked-by: Daniel Bistrot de Oliveira <danielbristot@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
---
 Documentation/scheduler/sched-deadline.txt | 6 ++++++
 kernel/sched/debug.c                       | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt
index 8e37b0b..cbc1b46 100644
--- a/Documentation/scheduler/sched-deadline.txt
+++ b/Documentation/scheduler/sched-deadline.txt
@@ -408,6 +408,11 @@ CONTENTS
   * the new scheduling related syscalls that manipulate it, i.e.,
     sched_setattr() and sched_getattr() are implemented.
 
+ For debugging purposes, the leftover runtime and absolute deadline of a
+ SCHED_DEADLINE task can be retrieved through /proc/<pid>/sched (entries
+ dl.runtime and dl.deadline, both values in ns). A programmatic way to
+ retrieve these values from production code is under discussion.
+
 
 4.3 Default behavior
 ---------------------
@@ -476,6 +481,7 @@ CONTENTS
 
  Still missing:
 
+  - programmatic way to retrieve current runtime and absolute deadline
   - refinements to deadline inheritance, especially regarding the possibility
     of retaining bandwidth isolation among non-interacting tasks. This is
     being studied from both theoretical and practical points of view, and
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index fa178b6..109adc0 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -953,6 +953,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 #endif
 	P(policy);
 	P(prio);
+	if (p->policy == SCHED_DEADLINE) {
+		P(dl.runtime);
+		P(dl.deadline);
+	}
 #undef PN_SCHEDSTAT
 #undef PN
 #undef __PN
-- 
2.7.4

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

* [tip:sched/core] sched/deadline: Show leftover runtime and abs deadline in /proc/*/sched
  2016-10-26  9:17   ` [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
@ 2017-01-14 12:47     ` tip-bot for Tommaso Cucinotta
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Tommaso Cucinotta @ 2017-01-14 12:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: danielbristot, linux-kernel, efault, luca.abeni, juri.lelli,
	tommaso.cucinotta, tglx, mingo, juri.lelli, torvalds, peterz,
	hpa

Commit-ID:  59f8c2989283bbd3df9fcfb22494d84f4852e536
Gitweb:     http://git.kernel.org/tip/59f8c2989283bbd3df9fcfb22494d84f4852e536
Author:     Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
AuthorDate: Wed, 26 Oct 2016 11:17:17 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 14 Jan 2017 11:30:00 +0100

sched/deadline: Show leftover runtime and abs deadline in /proc/*/sched

This patch allows for reading the current (leftover) runtime and
absolute deadline of a SCHED_DEADLINE task through /proc/*/sched
(entries dl.runtime and dl.deadline), while debugging/testing.

Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
Reviewed-by: Luca Abeni <luca.abeni@unitn.it>
Acked-by: Daniel Bistrot de Oliveira <danielbristot@gmail.com>
Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1477473437-10346-2-git-send-email-tommaso.cucinotta@sssup.it
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 Documentation/scheduler/sched-deadline.txt | 6 ++++++
 kernel/sched/debug.c                       | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.txt
index 8e37b0b..cbc1b46 100644
--- a/Documentation/scheduler/sched-deadline.txt
+++ b/Documentation/scheduler/sched-deadline.txt
@@ -408,6 +408,11 @@ CONTENTS
   * the new scheduling related syscalls that manipulate it, i.e.,
     sched_setattr() and sched_getattr() are implemented.
 
+ For debugging purposes, the leftover runtime and absolute deadline of a
+ SCHED_DEADLINE task can be retrieved through /proc/<pid>/sched (entries
+ dl.runtime and dl.deadline, both values in ns). A programmatic way to
+ retrieve these values from production code is under discussion.
+
 
 4.3 Default behavior
 ---------------------
@@ -476,6 +481,7 @@ CONTENTS
 
  Still missing:
 
+  - programmatic way to retrieve current runtime and absolute deadline
   - refinements to deadline inheritance, especially regarding the possibility
     of retaining bandwidth isolation among non-interacting tasks. This is
     being studied from both theoretical and practical points of view, and
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index fa178b6..109adc0 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -953,6 +953,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 #endif
 	P(policy);
 	P(prio);
+	if (p->policy == SCHED_DEADLINE) {
+		P(dl.runtime);
+		P(dl.deadline);
+	}
 #undef PN_SCHEDSTAT
 #undef PN
 #undef __PN

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

end of thread, other threads:[~2017-01-14 12:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 22:32 [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta
2016-10-24 22:32 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
2016-10-25  9:39   ` Juri Lelli
2016-10-25  9:25 ` [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Peter Zijlstra
2016-10-25  9:33   ` Juri Lelli
2016-10-25 10:10     ` luca abeni
2016-10-25 11:31       ` Daniel Bristot de Oliveira
2016-10-26  9:17 ` [PATCH] " Tommaso Cucinotta
2016-10-26  9:17   ` [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta
2017-01-14 12:47     ` [tip:sched/core] sched/deadline: Show " tip-bot for Tommaso Cucinotta

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