Re: [kernel/sched/core.c] Review and Modified of the prio_less() about sched class priority.

From: JaeJoon Jung
Date: Mon Feb 13 2023 - 18:45:01 EST


Thank you for answering.
Is it going to be reflected in your patch?

JaeJoon Jung.

On Mon, 13 Feb 2023 at 19:08, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Mon, Feb 13, 2023 at 10:11:04AM +0900, JaeJoon Jung wrote:
> > The sched_class structure is defined to be sorted by pointer size.
> > @@ -176,22 +161,18 @@ static inline int __task_prio(struct task_struct *p)
> > /* real prio, less is less */
> > static inline bool prio_less(struct task_struct *a, struct
> > task_struct *b, bool in_fi)
> > {
> > + int less = a->sched_class - b->sched_class;
> >
> > + if (less == 0) {
> > + if (a->sched_class == &dl_sched_class)
> > + return !dl_time_before(a->dl.deadline, b->dl.deadline);
> >
> > + else if (a->sched_class == &fair_sched_class)
> > + return cfs_prio_less(a, b, in_fi);
> > + else
> > + return false;
> > + } else
> > + return (less > 0) ? true : false;
> > }
> >
> > If the prio_less() function is modified as above, the __task_prio()
> > function is not required.
>
> Yeah, except your patch is whitespace mangled..