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

From: Mike Rapoport
Date: Tue Nov 27 2018 - 16:45:55 EST




On November 27, 2018 11:08:50 PM GMT+02:00, Hugh Dickins <hughd@xxxxxxxxxx> wrote:
>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.

Hmm, indeed, making this kernel-doc would be premature.
I was thinking about including this in a future description of the filemap internals, but until that would get written lot of things may change.

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

--
Sincerely yours,
Mike.