Re: [PATCH RFC v2 0/3] mm: Properly document tail pages for a folio

From: Matthew Wilcox
Date: Mon Aug 14 2023 - 15:59:36 EST


On Mon, Aug 14, 2023 at 02:44:08PM -0400, Peter Xu wrote:

Look, this is all still too complicated. And you're trying to make
something better that I'm trying to make disappear. I'd really rather
you spent your time worrying about making userfaultfd use folios
than faffing with this.

How about this?

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5e74ce4a28cd..873285bb5d45 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -334,11 +334,14 @@ struct folio {
/* public: */
unsigned char _folio_dtor;
unsigned char _folio_order;
+ /* two bytes available here */
atomic_t _entire_mapcount;
atomic_t _nr_pages_mapped;
atomic_t _pincount;
+ /* no more space on 32-bt */
#ifdef CONFIG_64BIT
unsigned int _folio_nr_pages;
+ /* twelve bytes available on 64-bit */
#endif
/* private: the union with struct page is transitional */
};
@@ -360,6 +363,7 @@ struct folio {
unsigned long _head_2a;
/* public: */
struct list_head _deferred_list;
+ /* three more words available here */
/* private: the union with struct page is transitional */
};
struct page __page_2;