Re: [PATCH v4 0/8] Remove dependency on congestion_wait in mm/

From: NeilBrown
Date: Fri Oct 22 2021 - 07:27:10 EST


On Fri, 22 Oct 2021, Mel Gorman wrote:
> On Fri, Oct 22, 2021 at 12:15:10PM +1100, NeilBrown wrote:
>
> > In general, I still don't like the use of wake_up_all(), though it won't
> > cause incorrect behaviour.
> >
>
> Removing wake_up_all would be tricky.

I think there is a misunderstanding. Removing wake_up_all() is as
simple as
s/wake_up_all/wake_up/

If you used prepare_to_wait_exclusive(), then wake_up() would only wake
one waiter, while wake_up_all() would wake all of them.
As you use prepare_to_wait(), wake_up() will wake all waiters - as will
wake_up_all().

When I see "wake_up_all()" I assume it is an exclusive wait, and that
for some reason this particular wake_up needs to wake up all waiters.
That is not the case here.

I suspect it would be clearer if "wake_up" always woke everything, and
"wake_up_one" was the special case - but unfortunately that isn't what
we have.

There are other non-exclusive waiters which use wake_up_all(), but the
vast majority of wakeups use wake_up(), and most of those are for
non-exclusive waiters.

Thanks,
NeilBrown