lkml.org 
[lkml]   [2020]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 15/21] mm/hugetlb: Add a BUILD_BUG_ON to check if struct page size is a power of two
Date
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 --git a/mm/hugetlb.c b/mm/hugetlb.c
index ec0d33d2c426..5aaa274b0684 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3764,6 +3764,10 @@ static int __init hugetlb_init(void)
{
int i;

+#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
+ BUILD_BUG_ON_NOT_POWER_OF_2(sizeof(struct page));
+#endif
+
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");
--
2.11.0
\
 
 \ /
  Last update: 2020-11-08 15:14    [W:0.228 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site