From: David Howells <dhowells@redhat.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: dhowells@redhat.com, dwysocha@redhat.com,
anna.schumaker@netapp.com, Matthew Wilcox <willy@infradead.org>,
linux-cachefs@redhat.com, linux-nfs@vger.kernel.org,
linux-mm@kvack.org
Subject: Can the GFP flags to releasepage() be trusted? -- was Re: [PATCH v2 3/8] nfs: Move to using the alternate fallback fscache I/O API
Date: Fri, 01 Oct 2021 15:51:56 +0100 [thread overview]
Message-ID: <81120.1633099916@warthog.procyon.org.uk> (raw)
In-Reply-To: <97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com>
Trond Myklebust <trondmy@hammerspace.com> wrote:
> > > @@ -432,7 +432,12 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
> > > /* If PagePrivate() is set, then the page is not freeable */
> > > if (PagePrivate(page))
> > > return 0;
> > > - return nfs_fscache_release_page(page, gfp);
> > > + if (PageFsCache(page)) {
> > > + if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS))
> > > + return false;
> > > + wait_on_page_fscache(page);
> > > + }
> > > + return true;
> > > }
>
> I've found this generally not to be safe. The VM calls ->release_page()
> from a variety of contexts, and often fails to report it correctly in
> the gfp flags. That's particularly true of the stuff in mm/vmscan.c.
> This is why we have the check above that vetos page removal upon
> PagePrivate() being set.
[Adding Willy and the mm crew to the cc list]
I wonder if that matters in this case. In the worst case, we'll wait for the
page to cease being DMA'd - but we won't return true if it is.
But if vmscan is generating the wrong VM flags, we should look at fixing that.
David
next parent reply other threads:[~2021-10-01 14:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com>
[not found] ` <163189104510.2509237.10805032055807259087.stgit@warthog.procyon.org.uk>
[not found] ` <163189108292.2509237.12615909591150927232.stgit@warthog.procyon.org.uk>
[not found] ` <CALF+zO=165sRYRaxPpDS7DaQCpTe-YOa4FamSoMy5FV2uuG5Yg@mail.gmail.com>
2021-10-01 14:51 ` David Howells [this message]
2021-10-01 15:04 ` Trond Myklebust
2021-10-01 19:42 ` Matthew Wilcox
2021-10-05 13:15 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81120.1633099916@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=anna.schumaker@netapp.com \
--cc=dwysocha@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@hammerspace.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox