On Thu, Apr 08, 2021 at 03:04:20PM +0100, David Howells wrote: > +static inline void set_page_private_2(struct page *page) > +{ > + get_page(page); > + SetPagePrivate2(page);
PAGEFLAG(OwnerPriv1, owner_priv_1, PF_ANY) So we can set Private2 on any tail page ... > +void end_page_private_2(struct page *page) > +{ > + page = compound_head(page); > + VM_BUG_ON_PAGE(!PagePrivate2(page), page); > + clear_bit_unlock(PG_private_2, &page->flags); > + wake_up_page_bit(page, PG_private_2); ... but when we try to end on a tail, we actually wake up the head ... > +void wait_on_page_private_2(struct page *page) > +{ > + while (PagePrivate2(page)) > + wait_on_page_bit(page, PG_private_2); ... although if we were waiting on a tail, the wake up won't find us ... if only we had a way to ensure this kind of bug can't happen *cough, lend your support to the page folio patches*.