Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

From: Hugh Dickins
Date: Tue Nov 27 2018 - 16:09:08 EST


On Tue, 27 Nov 2018, Mike Rapoport wrote:
> On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote:
> >
> > +/*
> > + * A choice of three behaviors for wait_on_page_bit_common():
> > + */
> > +enum behavior {
> > + EXCLUSIVE, /* Hold ref to page and take the bit when woken, like
> > + * __lock_page() waiting on then setting PG_locked.
> > + */
> > + SHARED, /* Hold ref to page and check the bit when woken, like
> > + * wait_on_page_writeback() waiting on PG_writeback.
> > + */
> > + DROP, /* Drop ref to page before wait, no check when woken,
> > + * like put_and_wait_on_page_locked() on PG_locked.
> > + */
> > +};
>
> Can we please make it:
>
> /**
> * enum behavior - a choice of three behaviors for wait_on_page_bit_common()
> */
> enum behavior {
> /**
> * @EXCLUSIVE: Hold ref to page and take the bit when woken,
> * like __lock_page() waiting on then setting %PG_locked.
> */
> EXCLUSIVE,
> /**
> * @SHARED: Hold ref to page and check the bit when woken,
> * like wait_on_page_writeback() waiting on %PG_writeback.
> */
> SHARED,
> /**
> * @DROP: Drop ref to page before wait, no check when woken,
> * like put_and_wait_on_page_locked() on %PG_locked.
> */
> DROP,
> };

I'm with Matthew, I'd prefer not: the first looks a more readable,
less cluttered comment to me than the second: this is just an arg
to an internal helper in mm/filemap.c, itself not kernel-doc'ed.

But the comment is not there for me: if consensus is that the
second is preferable, then sure, we can change it over.

Hugh