[PATCH v1 1/2] KVM: arm64: Do not transfer page refcount for THP adjustment
Matthew Wilcox
willy at infradead.org
Wed Sep 27 00:00:28 PDT 2023
On Tue, Sep 26, 2023 at 07:19:31PM +0100, Vincent Donnefort wrote:
> With folios, GUP affects a refcount common to all pages forming the THP.
> There is therefore no need to move the refcount from the tail to the
> head page. Under the hood it decrements and increments
> the same counter.
FYI, this isn't new to folios. get_page() has _always_ operated on the
head page of a compound page. Here's how it worked in 2.6.12-rc2:
+static inline void get_page(struct page *page)
+{
+ if (unlikely(PageCompound(page)))
+ page = (struct page *)page->private;
+ atomic_inc(&page->_count);
+}
I can't be bothered to switch over to the linux-fullhistory tree and
show how it evolved, because i think this sufficiently makes the point --
you can backport this patch as far as you like.
Folios just make it obvious that this is what's going on. And that's a
good thing! Making the MM less inscrutable is a win for everybody.
More information about the linux-arm-kernel
mailing list