From: Gao Xiang <hsiangkao@aol.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Chris Mason <clm@fb.com>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
Guoqing Jiang <guoqing.jiang@cloud.ionos.com>,
Miaohe Lin <linmiaohe@huawei.com>,
David Howells <dhowells@redhat.com>
Subject: Re: PagePrivate handling
Date: Thu, 15 Oct 2020 00:01:30 +0800 [thread overview]
Message-ID: <20201014160116.GA7037@hsiangkao-HP-ZHAN-66-Pro-G1> (raw)
In-Reply-To: <20201014153836.GM20115@casper.infradead.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8\"", Size: 2355 bytes --]
On Wed, Oct 14, 2020 at 04:38:36PM +0100, Matthew Wilcox wrote:
> On Wed, Oct 14, 2020 at 10:50:51AM -0400, Chris Mason wrote:
> > On 14 Oct 2020, at 9:49, Matthew Wilcox wrote:
...
> > >
> > > Also ... do we really need to increment the page refcount if we have
> > > PagePrivate set? I'm not awfully familiar with the buffercache -- is
> > > it possible we end up in a situation where a buffer, perhaps under I/O,
> > > has the last reference to a struct page? It seems like that reference
> > > is
> > > always put from drop_buffers() which is called from
> > > try_to_free_buffers()
> > > which is always called by someone who has a reference to a struct page
> > > that they got from the pagecache. So what is this reference count for?
> >
> > I’m not sure what we gain by avoiding the refcount bump? Many filesystems
> > use the pattern of: “put something in page->private, free that thing in
> > releasepage.†Without the refcount bump it feels like we’d have more magic
> > to avoid freeing the page without leaking things in page->private. I think
> > the extra ref lets the FS crowd keep our noses out of the MM more often, so
> > it seems like a net positive to me.
>
> The question is whether the "thing" in page->private can ever have the
> last reference on a struct page. Gao says erofs can be in that situation,
> so never mind this change.
Add some words, just my thought... we have a management structure which could
store PagePrivate page cache pages, !PagePrivate page cache pages, and non-page
cache pages which are directly from buddy system.
and I knew the extra refcount rule for PagePrivate from the beginning (since
the rule is quite stable for many many years (I remembered from 200x introduced
by akpm?) so I designed the whole workflow to handle these different types of
pages in the management structure based on this rule and to make reclaim &
migrate work for all page cache pages properly.). I think many modules think
the rule is stable as well ... anyway, I think there's always be another way
to handle the same thing if the refcount rule is changed, yet I need to
revisit all current logic and do proper changes. And I think many modules
(including out-of-tree modules) could be impacted as well... anyway...
Thanks,
Gao Xiang
>
next prev parent reply other threads:[~2020-10-14 16:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 13:49 Matthew Wilcox
2020-10-14 14:50 ` Chris Mason
2020-10-14 15:38 ` Matthew Wilcox
2020-10-14 16:01 ` Gao Xiang [this message]
2020-10-14 16:28 ` Chris Mason
2020-10-14 16:34 ` Yang Shi
2020-10-14 16:05 ` 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=20201014160116.GA7037@hsiangkao-HP-ZHAN-66-Pro-G1 \
--to=hsiangkao@aol.com \
--cc=clm@fb.com \
--cc=dhowells@redhat.com \
--cc=guoqing.jiang@cloud.ionos.com \
--cc=linmiaohe@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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