Re: [PATCH v2 3/3] mm: remove superfluous __ClearPageWaiters()

From: Yang Shi
Date: Wed Aug 19 2020 - 20:17:05 EST


On Wed, Aug 19, 2020 at 4:39 PM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
>
> On Wed, Aug 19, 2020 at 04:06:32PM -0700, Yang Shi wrote:
> > On Tue, Aug 18, 2020 at 11:47 AM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
> > >
> > > Presumably __ClearPageWaiters() was added to follow the previously
> > > removed __ClearPageActive() pattern.
> > >
> > > Only flags that are in PAGE_FLAGS_CHECK_AT_FREE needs to be properly
> > > cleared because otherwise we think there may be some kind of leak.
> > > PG_waiters is not one of those flags and leaving the clearing to
> > > PAGE_FLAGS_CHECK_AT_PREP is more appropriate.
> >
> > Actually TBH I'm not very keen to this change, it seems the clearing
> > is just moved around and the allocation side pays for that instead of
> > free side.
>
> I'll assume you are referring to the overhead from clearing
> PG_waiters. First of all, there is no overhead -- we should have a
> serious talk with the hardware team who makes word-size bitwise AND
> more than one instruction. And the clearing is done in
> free_pages_prepare(), which has nothing to do with allocations.

Oh, yes, you are right. Now I'm wondering why we have the waiter bit
cleared at the first place.