@@ -329,11 +329,21 @@ struct folio {
/* public: */
unsigned char _folio_dtor;
unsigned char _folio_order;
+ /* private: 2 bytes can be reused later */
+ unsigned char _free_1_0[2];
+#ifdef CONFIG_64BIT
+ /* 4 bytes can be reused later (64 bits only) */
+ unsigned char _free_1_1[4];
+#endif
+ /* public: */
atomic_t _entire_mapcount;
atomic_t _nr_pages_mapped;
atomic_t _pincount;
#ifdef CONFIG_64BIT
unsigned int _folio_nr_pages;
+ /* private: 4 bytes can be reused later (64 bits only) */
+ unsigned char _free_1_2[4];
+ /* public: */
#endif
/* private: the union with struct page is transitional */
};
@@ -355,6 +365,8 @@ struct folio {
unsigned long _head_2a;
/* public: */
struct list_head _deferred_list;
+ /* private: 8 more free bytes for either 32/64 bits */
+ unsigned char _free_2_1[8];
/* private: the union with struct page is transitional */
};
struct page __page_2;
It's not 100% clear on what are the free spaces in the folio tail pages. Currently we defined fields for only tail pages 1-2 but they're not really fully occupied. Add the fields to show what is free, and also reorg them a bit to make 32/64 bits alignment easy. Here _free_1_0 should be a constant hole (of 2 bytes) on any system, make them explicit so people know they can be reused at any time. _free_1_1 is special and need some attention: this will shift tail page 1's fields starting from _entire_mapcount to be 4 bytes later. I don't expect this change much on real performance - if it will it might be good to have _entire_mapcount and _nr_pages_mapped to be put on the same 8B alignment, assuming that _pincount should be rarer to be used in real life. But in all cases the movement shouldn't change much on x86 or anything that has 64B cachelines. This is the major reason why I had this change separate from the upcoming documentation update patch - it may need some attention, and when unwanted things happen (I don't expect) we quickly know what's wrong. _free_1_2 / _free_2_1 just calls out extra free spaces elsewhere and shouldn't affect a thing just like _free_1_0. Signed-off-by: Peter Xu <peterx@redhat.com> --- include/linux/mm_types.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)