Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507829 > unrolled thread

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

Started byTommaso Cucinotta <tommaso.cucinotta@sssup.it>
First post2016-10-25 01:40 +0200
Last post2016-10-26 11:20 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta <tommaso.cucinotta@sssup.it> - 2016-10-25 01:40 +0200
    Re: [RFC PATCH] sched/deadline: show leftover runtime and abs  deadline in /proc/-/sched Peter Zijlstra <peterz@infradead.org> - 2016-10-25 11:30 +0200
      Re: [RFC PATCH] sched/deadline: show leftover runtime and abs  deadline in /proc/-/sched Juri Lelli <juri.lelli@arm.com> - 2016-10-25 11:40 +0200
        Re: [RFC PATCH] sched/deadline: show leftover runtime and abs  deadline in /proc/-/sched luca abeni <luca.abeni@unitn.it> - 2016-10-25 12:20 +0200
          Re: [RFC PATCH] sched/deadline: show leftover runtime and abs  deadline in /proc/-/sched Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-10-25 13:40 +0200
    [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched Tommaso Cucinotta <tommaso.cucinotta@sssup.it> - 2016-10-26 11:20 +0200
    [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched Tommaso Cucinotta <tommaso.cucinotta@sssup.it> - 2016-10-26 11:20 +0200

#1507829 — [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

FromTommaso Cucinotta <tommaso.cucinotta@sssup.it>
Date2016-10-25 01:40 +0200
Subject[RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<svX0t-5XK-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1508109 — Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

FromPeter Zijlstra <peterz@infradead.org>
Date2016-10-25 11:30 +0200
SubjectRe: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<sw6dr-3Ia-5@gated-at.bofh.it>
In reply to#1507829
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?

[toc] | [prev] | [next] | [standalone]


#1508120 — Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

FromJuri Lelli <juri.lelli@arm.com>
Date2016-10-25 11:40 +0200
SubjectRe: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<sw6n8-3Lf-19@gated-at.bofh.it>
In reply to#1508109
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)

[toc] | [prev] | [next] | [standalone]


#1508159 — Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

Fromluca abeni <luca.abeni@unitn.it>
Date2016-10-25 12:20 +0200
SubjectRe: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<sw6ZP-4he-3@gated-at.bofh.it>
In reply to#1508120
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

[toc] | [prev] | [next] | [standalone]


#1508224 — Re: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

FromDaniel Bristot de Oliveira <bristot@redhat.com>
Date2016-10-25 13:40 +0200
SubjectRe: [RFC PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<sw8ff-4ZX-27@gated-at.bofh.it>
In reply to#1508159
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

[toc] | [prev] | [next] | [standalone]


#1508977 — [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched

FromTommaso Cucinotta <tommaso.cucinotta@sssup.it>
Date2016-10-26 11:20 +0200
Subject[PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/*/sched
Message-ID<swsxj-1EJ-3@gated-at.bofh.it>
In reply to#1507829
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

[toc] | [prev] | [next] | [standalone]


#1508984 — [PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched

FromTommaso Cucinotta <tommaso.cucinotta@sssup.it>
Date2016-10-26 11:20 +0200
Subject[PATCH] sched/deadline: show leftover runtime and abs deadline in /proc/-/sched
Message-ID<swsxj-1EJ-5@gated-at.bofh.it>
In reply to#1507829
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()?)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web