Re: [PATCH 3/5] sched: add a few helpers to wake up tasks on the current cpu

From: Peter Zijlstra
Date: Thu Jan 19 2023 - 05:10:11 EST


On Wed, Jan 18, 2023 at 10:45:33PM -0800, Andrei Vagin wrote:
> On Mon, Jan 16, 2023 at 1:59 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> > So I hate this patch, it adds a whole ton of duplication and litter for
> > no real reason afaict. For instance you could've just added an
> > wake_flags argument to swake_up_locked(), there's not *that* many users
> > -- unlike complete().
> >
> > And for complete() instead of fully duplicating the function (always a
> > bad idea) you could've made complete_flags() and implemented complete()
> > using that, or something.
> >
> > Anyway, let me go (finally) have a look at Chen's patch, since that
> > might render all this moot.
>
> If it is the only concern, it is easy to fix. I think I decided to do it
> this way because swake_up_locked is in include/linux/swait.h, but wakeup
> flags are in kernel/sched/sched.h. I agree that it is better to avoid
> this code duplication.

Thanks.

> Regarding Chen's proposed patch, unfortunately, it does not solve our
> problem. It works only in narrow conditions. One of the major problems
> is that it does nothing if there are idle cores. The advantage of my
> changes is that they work predictably, and they provide benefits
> regardless of other workloads running on the same host.

Oh well.. carry on then. Can't always have two birds thing I suppose :-)