[RFC PATCH v1 06/10] mm/hugetlb: use separate folio->_hugetlb_list for hugetlb-internals

wang wei a929244872 at 163.com
Tue Nov 12 15:28:49 UTC 2024


Signed-off-by: wang wei <a929244872 at 163.com>
---
>diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
>index 80fef38d9d64..365c73be0bb4 100644
>--- a/include/linux/mm_types.h
>+++ b/include/linux/mm_types.h
>@@ -310,6 +310,7 @@ typedef struct {
>  * @_hugetlb_cgroup: Do not use directly, use accessor in hugetlb_cgroup.h.
>  * @_hugetlb_cgroup_rsvd: Do not use directly, use accessor in hugetlb_cgroup.h.
>  * @_hugetlb_hwpoison: Do not use directly, call raw_hwp_list_head().
>+ * @_hugetlb_list: To be used in hugetlb core code only.
>  * @_deferred_list: Folios to be split under memory pressure.
>  * @_unused_slab_obj_exts: Placeholder to match obj_exts in struct slab.
>  *
>@@ -397,6 +398,17 @@ struct folio {
> 		};
> 		struct page __page_2;
> 	};
>+	union {
>+		struct {
>+			unsigned long _flags_3;
>+			unsigned long _head_3;
>+	/* public: */
>+			struct list_head _hugetlb_list;
>+	/* private: the union with struct page is transitional */
>+		};
>+		struct page __page_3;
>+	};
>+
> };
> 
As far as I know, increasing the size of folio maybe decrease 
the revenue of HVO, do you measure it?
> #define FOLIO_MATCH(pg, fl)						\
>@@ -433,6 +445,12 @@ FOLIO_MATCH(compound_head, _head_2);
> FOLIO_MATCH(flags, _flags_2a);
> FOLIO_MATCH(compound_head, _head_2a);
> #undef FOLIO_MATCH
>+#define FOLIO_MATCH(pg, fl)						\
>+	static_assert(offsetof(struct folio, fl) ==			\
>+			offsetof(struct page, pg) + 3 * sizeof(struct page))
>+FOLIO_MATCH(flags, _flags_3);
>+FOLIO_MATCH(compound_head, _head_3);
>+#undef FOLIO_MATCH
> 
> /**
>  * struct ptdesc -    Memory descriptor for page tables.
-- 
2.25.1



More information about the dri-devel mailing list