Re: [PATCH 05/31] sched: Add sched_class->reweight_task()

From: Peter Zijlstra
Date: Mon Dec 12 2022 - 15:12:51 EST


On Mon, Dec 12, 2022 at 07:34:27AM -1000, Tejun Heo wrote:
> Hello,
>
> On Mon, Dec 12, 2022 at 12:22:43PM +0100, Peter Zijlstra wrote:
> > On Tue, Nov 29, 2022 at 10:22:47PM -1000, Tejun Heo wrote:
> > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > > index a4a20046e586..08799b2a566e 100644
> > > --- a/kernel/sched/sched.h
> > > +++ b/kernel/sched/sched.h
> > > @@ -2193,6 +2193,8 @@ struct sched_class {
> > > */
> > > void (*switched_from)(struct rq *this_rq, struct task_struct *task);
> > > void (*switched_to) (struct rq *this_rq, struct task_struct *task);
> > > + void (*reweight_task)(struct rq *this_rq, struct task_struct *task,
> > > + int newprio);
> > > void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
> > > int oldprio);
> >
> > Hurmph.. this further propagate the existing problem of thinking that
> > 'prio' is a useful concept in general (it isn't).
>
> I'm not quite following. Can you please expand on why prio isn't a generally
> useful concept?

The whole fixed vs dynamic priority scheduling thing. Specifically
SCHED_DEADLINE implements a dynamic priority scheme using the sporadic
task model which just doesn't map well to this single prio value
(notably every SCHED_DEADLINE task has prio -1, making it impossible to
order SCHED_DEADLINE tasks based on this).