From: Matthew Wilcox <willy@infradead.org>
To: Yang Shi <shy828301@gmail.com>
Cc: Hugh Dickins <hughd@google.com>, Song Liu <song@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Hao Sun <sunhao.th@gmail.com>, Linux MM <linux-mm@kvack.org>,
Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH] fs: buffer: check huge page size instead of single page for invalidatepage
Date: Thu, 21 Oct 2021 02:36:49 +0100 [thread overview]
Message-ID: <YXDEMURz5267/Wv2@casper.infradead.org> (raw)
In-Reply-To: <CAHbLzkqHx=RRXAEjOunVOiJobkvQg0p005-ggSpLgcAn75QkOA@mail.gmail.com>
On Wed, Oct 20, 2021 at 05:24:09PM -0700, Yang Shi wrote:
> On Wed, Oct 20, 2021 at 4:51 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Wed, Oct 20, 2021 at 04:38:49PM -0700, Yang Shi wrote:
> > > > However, it still doesn't make too much sense to have thp_size passed
> > > > to do_invalidatepage(), then have PAGE_SIZE hardcoded in a BUG
> > > > assertion IMHO. So it seems this patch is still useful because
> > > > block_invalidatepage() is called by a few filesystems as well, for
> > > > example, ext4. Or I'm wondering whether we should call
> > > > do_invalidatepage() for each subpage of THP in truncate_cleanup_page()
> > > > since private is for each subpage IIUC.
> > >
> > > Seems no interest?
> >
> > No. I have changes in this area as part of the folio patchset (where
> > we end up converting this to invalidate_folio). I'm not really
> > interested in doing anything before that, since this shouldn't be
> > reachable today.
>
> Understood. But this is definitely reachable unless Hugh's patch
> (skipping non-regular file) is applied.
Right. That's the bug that needs to be fixed. Seeing THPs here is
a symptom. Getting rid of the error just makes the problem silent.
> > > Anyway the more I was staring at the code the more I thought calling
> > > do_invalidatepage() for each subpage made more sense. So, something
> > > like the below makes sense?
> >
> > Definitely not. We want to invalidate the entire folio at once.
>
> I didn't look at the folio patch (on each individual patch level), but
> I'm supposed it still needs to invalidate buffer for each subpage,
> right?
No. Buffers are tracked for the entire folio, not on each subpage.
Actually, the filesystem people currently believe that the O(n^2) nature
of buffer-head handling mean that it's a bad idea to create multi-page
folios for bufferhead based filesystems (which includes block devices),
and the correct path forward is to migrate away from buffer-heads.
That may change, but it's the current plan.
prev parent reply other threads:[~2021-10-21 1:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 20:57 [PATCH] fs: buffer: check huge page size instead of single page for invalidatepage Yang Shi
2021-09-18 0:07 ` Yang Shi
2021-09-19 14:40 ` Matthew Wilcox
2021-09-20 21:23 ` Yang Shi
2021-09-20 21:50 ` Matthew Wilcox
2021-09-20 22:35 ` Yang Shi
2021-10-11 19:57 ` Yang Shi
2021-10-20 23:38 ` Yang Shi
2021-10-20 23:49 ` Matthew Wilcox
2021-10-21 0:24 ` Yang Shi
2021-10-21 1:36 ` Matthew Wilcox [this message]
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=YXDEMURz5267/Wv2@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--cc=song@kernel.org \
--cc=songliubraving@fb.com \
--cc=sunhao.th@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).