On Mon, May 17, 2021 at 05:02:01PM -0700, Linus Torvalds wrote: > On Mon, May 17, 2021 at 4:37 PM Linus Torvalds > <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > I don't mind that rule, but what's the advantage of introducing a new > > name for that? IOW, I get the feeling that almost all of this > > could/should just be "don't use non-head pages". > > Put another way: I've often wanted to remove the (quite expensive) > "compund_head()" calls out of the code page functions, and move them > into the callers (and in most cases they probably just end up > disappearing entirely, because the callers fundamentally always have a > proper head page). > > It feels like this is what the folio patches do, they just spend a > *lot* of effort doing so incrementally by renaming things and > duplicating functionality, rather than just do it (again > incrementally) by just doing one compound_head() movement at a time.. I tried that, and I ended up in whack-a-mole hell trying to figure out all the places that weren't expecting to see a head page. If you look at the master branch from that repo: https://git.infradead.org/users/willy/pagecache.git/shortlog it basically redefines a THP to be arbitrary order and then tries to ram through using head pages everywhere. It's definitely missing a few spots in the writeback code that get the accounting entirely wrong. So I decided a new type was in order to distinguish between the places which do need to see a struct page (vmf->page being one) and those that are dealing with pages for accounting purposes.