On Mon, Aug 23, 2021 at 03:06:08PM -0700, Linus Torvalds wrote:
Yeah, honestly, I would have preferred to see this done the exact
reverse way: make the rule be that "struct page" is always a head
page, and anything that isn't a head page would be called something
else.
Because, as you say, head pages are the norm. And "folio" may be a
clever term, but it's not very natural. Certainly not at all as
intuitive or common as "page" as a name in the industry.
Actually, I think this is an advantage for folios. Maybe not for the
core MM which has always been _fairly_ careful to deal with compound
pages properly. But for filesystem people, device drivers, etc, when
people see a struct page, they think it's PAGE_SIZE bytes in size.
And they're usually right, which is what makes things like THP so prone
to "Oops, we missed a spot" bugs. By contrast, if you see something
which takes a struct folio and then works on PAGE_SIZE bytes, that's a
sign there's something funny going on. There are a few of those still;
for example kmap() can only map PAGE_SIZE bytes at a time.