[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210323155048.GB2438080@infradead.org>
Date: Tue, 23 Mar 2021 15:50:48 +0000
From: Christoph Hellwig <hch@...radead.org>
To: Johannes Weiner <hannes@...xchg.org>
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-cachefs@...hat.com,
linux-afs@...ts.infradead.org
Subject: Re: [PATCH v5 00/27] Memory Folios
On Mon, Mar 22, 2021 at 01:59:24PM -0400, Johannes Weiner wrote:
> If that is the case, shouldn't there in the long term only be very
> few, easy to review instances of things like compound_head(),
> PAGE_SIZE etc. deep in the heart of MM? And everybody else should 1)
> never see tail pages and 2) never assume a compile-time page size?
Probably.
> But this part is already getting better, and has gotten better, with
> the page cache (largely?) going native for example.
As long as there is no strong typing it is going to remain a mess.
> So I fully agree with the motivation behind this patch. But I do
> wonder why it's special-casing the commmon case instead of the rare
> case. It comes at a huge cost. Short term, the churn of replacing
> 'page' with 'folio' in pretty much all instances is enormous.
The special case is in the eye of the beholder. I suspect we'll end
up using the folio in most FS/VM interaction eventually, which makes it
the common. But I don't see how it is the special case? Yes, changing
from page to folio just about everywhere causes more change, but it also
allow to:
a) do this gradually
b) thus actually audit everything that we actually do the right thing
And I think willys whole series (the git branch, not just the few
patches sent out) very clearly shows the benefit of that.
> And longer term, I'm not convinced folio is the abstraction we want
> throughout the kernel. If nobody should be dealing with tail pages in
> the first place, why are we making everybody think in 'folios'? Why
> does a filesystem care that huge pages are composed of multiple base
> pages internally? This feels like an implementation detail leaking out
> of the MM code. The vast majority of places should be thinking 'page'
> with a size of 'page_size()'. Including most parts of the MM itself.
Why does the name matter? While there are arguments both ways, the
clean break certainly helps every to remind everyone that this is not
your grandfathers fixed sized page.
>
> The compile-time check is nice, but I'm not sure it would be that much
> more effective at catching things than a few centrally placed warns
> inside PageFoo(), get_page() etc. and other things that should not
> encounter tail pages in the first place (with __helpers for the few
> instances that do).
Eeek, no. No amount of runtime checks is going to replace compile
time type safety.
Powered by blists - more mailing lists