Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
Document in Documentation/sched/sched-deadline.rst the new capability of sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute deadline (setting the flags syscall parameter to 1), in addition to the static parameters (obtained with flags=0).
Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
---
Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index ec543a12..03970cc8 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -628,10 +628,21 @@ Deadline Task Scheduling
* 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.
+ The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be
+ read using the sched_getattr() syscall, setting the last syscall parameter
+ `flags' to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the
+ runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference,
+ then returns these parameters to user-space. The absolute deadline is
+ returned as the number of nanoseconds since the CLOCK_MONOTONIC time
+ reference (boot instant), as a u64 in the sched_deadline field of sched_attr,
+ which can represent nearly 585 years since boot time (calling sched_getattr()
+ with flags=0 causes retrieval of the static parameters instead).
+
+ For debugging purposes, these parameters can also be retrieved through
+ /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns),
+ but: this is highly inefficient; the returned runtime left is not updated as
+ done by sched_getattr(); the deadline is provided in kernel rq_clock time
+ reference, that is not directly usable from user-space.
4.3 Default behavior
base-commit: f74d204baf9febf96237af6c1d7eff57fba7de36
--
2.45.2
Compared to the initially submitted documentation patch, this version addresses the issue highlighted by Juri of the wrong wrapping of the commit message, and the one found by the chatbot of the wrong use of quotes around the flags parameter. I'm also adding "v2" in the subject line, as requested by Randy.
Document in Documentation/sched/sched-deadline.rst the new capability of
sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute
deadline (setting the flags syscall parameter to 1), in addition to the static
parameters (obtained with flags=0).
Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
---
Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index ec543a12..76fdf435 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -628,10 +628,21 @@ Deadline Task Scheduling
* 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.
+ The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be
+ read using the sched_getattr() syscall, setting the last syscall parameter
+ flags to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the
+ runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference,
+ then returns these parameters to user-space. The absolute deadline is
+ returned as the number of nanoseconds since the CLOCK_MONOTONIC time
+ reference (boot instant), as a u64 in the sched_deadline field of sched_attr,
+ which can represent nearly 585 years since boot time (calling sched_getattr()
+ with flags=0 causes retrieval of the static parameters instead).
+
+ For debugging purposes, these parameters can also be retrieved through
+ /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns),
+ but: this is highly inefficient; the returned runtime left is not updated as
+ done by sched_getattr(); the deadline is provided in kernel rq_clock time
+ reference, that is not directly usable from user-space.
4.3 Default behavior
base-commit: f74d204baf9febf96237af6c1d7eff57fba7de36
--
2.45.2
Tommaso Cucinotta <tommaso.cucinotta@gmail.com> writes: > Document in Documentation/sched/sched-deadline.rst the new capability of > sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute > deadline (setting the flags syscall parameter to 1), in addition to the static > parameters (obtained with flags=0). > > Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it> > Acked-by: Juri Lelli <juri.lelli@redhat.com> > --- > Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) Applied, thanks. jon
Hi Tommaso, kernel test robot noticed the following build warnings: [auto build test WARNING on f74d204baf9febf96237af6c1d7eff57fba7de36] url: https://github.com/intel-lab-lkp/linux/commits/Tommaso-Cucinotta/sched-deadline-document-new-sched_getattr-feature-for-retrieving-current-parameters-for-DEADLINE-tasks/20260303-184545 base: f74d204baf9febf96237af6c1d7eff57fba7de36 patch link: https://lore.kernel.org/r/20260303104215.1324243-1-tommaso.cucinotta%40santannapisa.it patch subject: [PATCH] sched/deadline: document new sched_getattr() feature for retrieving current parameters for DEADLINE tasks compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux) reproduce: (https://download.01.org/0day-ci/archive/20260303/202603031858.JyW2vicC-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202603031858.JyW2vicC-lkp@intel.com/ All warnings (new ones prefixed by >>): Checksumming on output with GSO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [docutils] >> Documentation/scheduler/sched-deadline.rst:631: WARNING: Inline interpreted text or phrase reference start-string without end-string. [docutils] Documentation/userspace-api/landlock:480: ./security/landlock/errata/abi-4.h:5: ERROR: Unexpected section title. vim +631 Documentation/scheduler/sched-deadline.rst 615 616 Specifying a periodic/sporadic task that executes for a given amount of 617 runtime at each instance, and that is scheduled according to the urgency of 618 its own timing constraints needs, in general, a way of declaring: 619 620 - a (maximum/typical) instance execution time, 621 - a minimum interval between consecutive instances, 622 - a time constraint by which each instance must be completed. 623 624 Therefore: 625 626 * a new struct sched_attr, containing all the necessary fields is 627 provided; 628 * the new scheduling related syscalls that manipulate it, i.e., 629 sched_setattr() and sched_getattr() are implemented. 630 > 631 The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be 632 read using the sched_getattr() syscall, setting the last syscall parameter 633 `flags' to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the 634 runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference, 635 then returns these parameters to user-space. The absolute deadline is 636 returned as the number of nanoseconds since the CLOCK_MONOTONIC time 637 reference (boot instant), as a u64 in the sched_deadline field of sched_attr, 638 which can represent nearly 585 years since boot time (calling sched_getattr() 639 with flags=0 causes retrieval of the static parameters instead). 640 641 For debugging purposes, these parameters can also be retrieved through 642 /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns), 643 but: this is highly inefficient; the returned runtime left is not updated as 644 done by sched_getattr(); the deadline is provided in kernel rq_clock time 645 reference, that is not directly usable from user-space. 646 647 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hello, On 03/03/26 11:41, Tommaso Cucinotta wrote: > Document in Documentation/sched/sched-deadline.rst the new capability of sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute deadline (setting the flags syscall parameter to 1), in addition to the static parameters (obtained with flags=0). Looks like changelog wasn't properly wrapped? > Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it> > Acked-by: Juri Lelli <juri.lelli@redhat.com> > --- > Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst > index ec543a12..03970cc8 100644 > --- a/Documentation/scheduler/sched-deadline.rst > +++ b/Documentation/scheduler/sched-deadline.rst > @@ -628,10 +628,21 @@ Deadline Task Scheduling > * 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. > + The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be > + read using the sched_getattr() syscall, setting the last syscall parameter > + `flags' to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the > + runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference, > + then returns these parameters to user-space. The absolute deadline is > + returned as the number of nanoseconds since the CLOCK_MONOTONIC time > + reference (boot instant), as a u64 in the sched_deadline field of sched_attr, > + which can represent nearly 585 years since boot time (calling sched_getattr() > + with flags=0 causes retrieval of the static parameters instead). > + > + For debugging purposes, these parameters can also be retrieved through > + /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns), > + but: this is highly inefficient; the returned runtime left is not updated as > + done by sched_getattr(); the deadline is provided in kernel rq_clock time > + reference, that is not directly usable from user-space. This looks good to me instead. Thanks, Juri
Document in Documentation/sched/sched-deadline.rst the new capability of
sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute
deadline (setting the flags syscall parameter to 1), in addition to the static
parameters (obtained with flags=0).
Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
---
Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index ec543a12..76fdf435 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -628,10 +628,21 @@ Deadline Task Scheduling
* 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.
+ The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be
+ read using the sched_getattr() syscall, setting the last syscall parameter
+ flags to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the
+ runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference,
+ then returns these parameters to user-space. The absolute deadline is
+ returned as the number of nanoseconds since the CLOCK_MONOTONIC time
+ reference (boot instant), as a u64 in the sched_deadline field of sched_attr,
+ which can represent nearly 585 years since boot time (calling sched_getattr()
+ with flags=0 causes retrieval of the static parameters instead).
+
+ For debugging purposes, these parameters can also be retrieved through
+ /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns),
+ but: this is highly inefficient; the returned runtime left is not updated as
+ done by sched_getattr(); the deadline is provided in kernel rq_clock time
+ reference, that is not directly usable from user-space.
4.3 Default behavior
base-commit: f74d204baf9febf96237af6c1d7eff57fba7de36
--
2.45.2
This patch should be marked as v2, with the differences between v1 and v2 described. On 3/3/26 10:42 AM, Tommaso Cucinotta wrote: > Document in Documentation/sched/sched-deadline.rst the new capability of > sched_getattr() to retrieve, for DEADLINE tasks, the runtime left and absolute > deadline (setting the flags syscall parameter to 1), in addition to the static > parameters (obtained with flags=0). > > Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it> > Acked-by: Juri Lelli <juri.lelli@redhat.com> > --- > Documentation/scheduler/sched-deadline.rst | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst > index ec543a12..76fdf435 100644 > --- a/Documentation/scheduler/sched-deadline.rst > +++ b/Documentation/scheduler/sched-deadline.rst > @@ -628,10 +628,21 @@ Deadline Task Scheduling > * 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. > + The leftover runtime and absolute deadline of a SCHED_DEADLINE task can be > + read using the sched_getattr() syscall, setting the last syscall parameter > + flags to the SCHED_GETATTR_FLAG_DL_DYNAMIC=1 value. This updates the About the build warning due to the use of `flags': If you want smart quotes, just use 'flags'. If you want italics, use `flags`. If you want a code-look (monotype), use ``flags``. > + runtime left, converts the absolute deadline in CLOCK_MONOTONIC reference, > + then returns these parameters to user-space. The absolute deadline is > + returned as the number of nanoseconds since the CLOCK_MONOTONIC time > + reference (boot instant), as a u64 in the sched_deadline field of sched_attr, > + which can represent nearly 585 years since boot time (calling sched_getattr() > + with flags=0 causes retrieval of the static parameters instead). > + > + For debugging purposes, these parameters can also be retrieved through > + /proc/<pid>/sched (entries dl.runtime and dl.deadline, both values in ns), > + but: this is highly inefficient; the returned runtime left is not updated as > + done by sched_getattr(); the deadline is provided in kernel rq_clock time > + reference, that is not directly usable from user-space. > > > 4.3 Default behavior > > base-commit: f74d204baf9febf96237af6c1d7eff57fba7de36 -- ~Randy
© 2016 - 2026 Red Hat, Inc.