Re: [PATCH 04/30] sched: Add sched_class->switching_to() and expose check_class_changing/changed()

From: Phil Auld
Date: Fri Jun 21 2024 - 15:32:53 EST


On Fri, Jun 21, 2024 at 09:18:46AM -1000 Tejun Heo wrote:
> Hello, Phil.
>
> On Fri, Jun 21, 2024 at 12:53:27PM -0400, Phil Auld wrote:
> > > A new BPF extensible sched_class will have callbacks that allow the BPF
> > > scheduler to keep track of relevant task states (like priority and cpumask).
> > > Those callbacks aren't called while a task is on a different sched_class.
> > > When a task comes back, we wanna tell the BPF progs the up-to-date state
> >
> > "wanna" ? How about "want to"?
> >
> > That makes me wanna stop reading right there... :)
>
> Sorry about that. Have been watching for it recently but this log was
> written a while ago, so...
>
> > > +/*
> > > + * ->switching_to() is called with the pi_lock and rq_lock held and must not
> > > + * mess with locking.
> > > + */
> > > +void check_class_changing(struct rq *rq, struct task_struct *p,
> > > + const struct sched_class *prev_class)
> > > +{
> > > + if (prev_class != p->sched_class && p->sched_class->switching_to)
> > > + p->sched_class->switching_to(rq, p);
> > > +}
> >
> > Does this really need wrapper? The compiler may help but it doesn't seem to
> > but you're doing a function call and passing in prev_class just to do a
> > simple check. I guess it's not really a fast path. Just seemed like overkill.
>
> This doesn't really matter either way but wouldn't it look weird if it's not
> symmetric with check_class_changed()?

Fair enough. It was just a thought.


Cheers,
Phil


>
> Thanks.
>
> --
> tejun
>

--