lkml.org 
[lkml]   [2019]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] sched: Document that RT task priorities are 1…99
Date
On 2019-04-03, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> John identified three files which claim that RT task priorities start at
> zero. As far as I understand, 0 is used for DL and has nothing to do
> wihich RT priorities as identified by the RT policy.
>
> Correct the comment, valid RT priorities are in the range from 1 to 99.
>
> Reported-by: John Ogness <john.ogness@linutronix.de>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> Documentation/scheduler/sched-rt-group.txt | 2 +-
> include/linux/sched/prio.h | 2 +-
> kernel/sched/cpupri.h | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/scheduler/sched-rt-group.txt b/Documentation/scheduler/sched-rt-group.txt
> index d8fce3e784574..23f8f8465a775 100644
> --- a/Documentation/scheduler/sched-rt-group.txt
> +++ b/Documentation/scheduler/sched-rt-group.txt
> @@ -175,7 +175,7 @@ get their allocated time.
>
> Implementing SCHED_EDF might take a while to complete. Priority Inheritance is
> the biggest challenge as the current linux PI infrastructure is geared towards
> -the limited static priority levels 0-99. With deadline scheduling you need to
> +the limited static priority levels 1-99. With deadline scheduling you need to
> do deadline inheritance (since priority is inversely proportional to the
> deadline delta (deadline - now)).
>
> diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
> index 7d64feafc408e..6986c32356842 100644
> --- a/include/linux/sched/prio.h
> +++ b/include/linux/sched/prio.h
> @@ -8,7 +8,7 @@
>
> /*
> * Priority of a process goes from 0..MAX_PRIO-1, valid RT
> - * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
> + * priority is 1..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH

Actually, valid RT priority is 0..MAX_RT_PRIO-2 (0-98). This comment is
talking about the kernel representation, not the userspace one.

> * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
> * values are inverted: lower p->prio value means higher priority.
> *
> diff --git a/kernel/sched/cpupri.h b/kernel/sched/cpupri.h
> index 7dc20a3232e72..40257a97fb8f2 100644
> --- a/kernel/sched/cpupri.h
> +++ b/kernel/sched/cpupri.h
> @@ -5,7 +5,7 @@
> #define CPUPRI_INVALID -1
> #define CPUPRI_IDLE 0
> #define CPUPRI_NORMAL 1
> -/* values 2-101 are RT priorities 0-99 */
> +/* values 2-101 are RT priorities 1-99 */

I suppose this also should be 0-98.

>
> struct cpupri_vec {
> atomic_t count;

IMHO it is a bit crazy that userspace RT prio 99 maps to kernel prio
0. This leaves a hole at kernel prio 99. Wouldn't it be better just to
map userspace RT prio 1-99 to kernel prio 99-1?

John Ogness

\
 
 \ /
  Last update: 2019-04-03 23:18    [W:0.066 / U:4.556 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site