Re: [PATCH sched_ext/for-6.11] sched, sched_ext: Replace scx_next_task_picked() with sched_class->switch_class()

Peter Zijlstra
2024-06-26T08:29:11Z

On Tue, Jun 25, 2024 at 01:30:05PM -1000, Tejun Heo wrote:
> Hello,
>
> On Tue, Jun 25, 2024 at 09:49:35AM +0200, Peter Zijlstra wrote:
> > > Imagine a case where a sched_ext task was running but then a RT task wakes
> > > up on the CPU. We'd enter the scheduling path, RT's pick_next_task() would
> > > return the new RT task to run. We now need to tell the BPF scheduler that we
> > > lost the CPU to the RT task but haven't called its pick_next_task() yet.
> >
> > Bah, I got it backwards indeed. But in this case, don't you also need
> > something in pick_task() -- the whole core scheduling thing does much
> > the same.
>
> Yes, indeed we do, but because we're dispatching from the balance path, the
> cpu_acquire method is being called from there. Because who was running on
> the CPU before us is less interesting, @prev is not passed into
> cpu_acquire() but if that becomes necessary, it's already available there
> too.

I suppose I need to read more, because I'm not knowing what cpu_acquire
is :/ I do know I don't much like the asymmetry here, but maybe it makes
sense, dunno.