[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210408145057.GN2531743@casper.infradead.org>
Date: Thu, 8 Apr 2021 15:50:57 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: linux-fsdevel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@....de>, linux-mm@...ck.org,
linux-cachefs@...hat.com, linux-afs@...ts.infradead.org,
linux-nfs@...r.kernel.org, linux-cifs@...r.kernel.org,
ceph-devel@...r.kernel.org, v9fs-developer@...ts.sourceforge.net,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Steve French <sfrench@...ba.org>,
Dominique Martinet <asmadeus@...ewreck.org>,
Jeff Layton <jlayton@...hat.com>,
David Wysochanski <dwysocha@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 02/30] mm: Add set/end/wait functions for PG_private_2
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*.
Powered by blists - more mailing lists