lkml.org 
[lkml]   [2020]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 20/21] mm/hugetlb: Add BUILD_BUG_ON to catch invalid usage of tail struct page
    Date
    There are only `RESERVE_VMEMMAP_SIZE / sizeof(struct page)` struct pages
    can be used when CONFIG_HUGETLB_PAGE_FREE_VMEMMAP, so add a BUILD_BUG_ON
    to catch this invalid usage of tail struct page.

    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    ---
    mm/hugetlb_vmemmap.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
    index bf2b6b3e75af..c3b3fc041903 100644
    --- a/mm/hugetlb_vmemmap.c
    +++ b/mm/hugetlb_vmemmap.c
    @@ -750,6 +750,9 @@ static int __init vmemmap_ptlock_init(void)
    {
    int nid;

    + BUILD_BUG_ON(NR_USED_SUBPAGE >=
    + RESERVE_VMEMMAP_SIZE / sizeof(struct page));
    +
    if (!hugepages_supported())
    return 0;

    --
    2.11.0
    \
     
     \ /
      Last update: 2020-11-20 07:51    [W:3.221 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site