Re: [tip:sched/core] sched/core: Document that RT task priorities are 1...99

From: Sebastian Andrzej Siewior
Date: Tue Apr 16 2019 - 08:08:21 EST


On 2019-04-16 13:22:35 [+0200], Peter Zijlstra wrote:
> On Tue, Apr 16, 2019 at 11:47:27AM +0200, Sebastian Andrzej Siewior wrote:
> > On 2019-04-16 11:36:34 [+0200], Peter Zijlstra wrote:
> > > On Tue, Apr 16, 2019 at 01:13:11AM -0700, tip-bot for Sebastian Andrzej Siewior wrote:
> > > > Commit-ID: 37a8f8590f307db8f8cfa62dfd82b3fc0978607c
> > > > Gitweb: https://git.kernel.org/tip/37a8f8590f307db8f8cfa62dfd82b3fc0978607c
> > > > Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > > > AuthorDate: Wed, 3 Apr 2019 23:08:21 +0200
> > > > Committer: Ingo Molnar <mingo@xxxxxxxxxx>
> > > > CommitDate: Tue, 16 Apr 2019 10:06:08 +0200
> > > >
> > > > sched/core: Document that RT task priorities are 1...99
> > > >
> > > > 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.
> > >
> > > DL is -1, 0 is still very much FIFO/FF
> >
> > but it can't be set. The lowest we can set is 1. Is this a bug then?
>
> What cannot be set?
| {
| struct sched_param sp;
| int r;
|
| sp.sched_priority = 0;
| r = sched_setscheduler_nocheck(current, SCHED_FIFO, &sp);
| pr_err("%s(%d): %d\n", __func__, __LINE__, r);
|
| }

-22 due to

4160 static int __sched_setscheduler(struct task_struct *p,
â
4191 /*
4192 * Valid priorities for SCHED_FIFO and SCHED_RR are
4193 * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL,
4194 * SCHED_BATCH and SCHED_IDLE is 0.
4195 */
4196 if ((p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
4197 (!p->mm && attr->sched_priority > MAX_RT_PRIO-1))
4198 return -EINVAL;
4199 if ((dl_policy(policy) && !__checkparam_dl(attr)) ||
4200 (rt_policy(policy) != (attr->sched_priority != 0)))
4201 return -EINVAL;
â

Sebastian