diff mbox series

[v2,13/19] mm/hugetlb: Add a BUILD_BUG_ON to check if struct page size is a power of two

Message ID 20201026145114.59424-14-songmuchun@bytedance.com (mailing list archive)
State New, archived
Headers show
Series Free some vmemmap pages of hugetlb page | expand

Commit Message

Muchun Song Oct. 26, 2020, 2:51 p.m. UTC
We only can free the unused vmemmap to the buddy system when the
size of struct page is a power of two. So add a BUILD_BUG_ON to
check the illegal case.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
 mm/hugetlb.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d98b55ad1a90..e3209fd2e6b2 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3776,6 +3776,10 @@  static int __init hugetlb_init(void)
 	int i;
+	BUILD_BUG_ON_NOT_POWER_OF_2(sizeof(struct page));
 	if (!hugepages_supported()) {
 		if (hugetlb_max_hstate || default_hstate_max_huge_pages)
 			pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n");