• Mike Kravetz's avatar
    hugetlb: perform vmemmap optimization on a list of pages · 79359d6d
    Mike Kravetz authored
    When adding hugetlb pages to the pool, we first create a list of the
    allocated pages before adding to the pool.  Pass this list of pages to a
    new routine hugetlb_vmemmap_optimize_folios() for vmemmap optimization.
    
    Due to significant differences in vmemmmap initialization for bootmem
    allocated hugetlb pages, a new routine prep_and_add_bootmem_folios is
    created.
    
    We also modify the routine vmemmap_should_optimize() to check for pages
    that are already optimized.  There are code paths that might request
    vmemmap optimization twice and we want to make sure this is not attempted.
    
    Link: https://lkml.kernel.org/r/20231019023113.345257-4-mike.kravetz@oracle.comSigned-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Barry Song <21cnbao@gmail.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: James Houghton <jthoughton@google.com>
    Cc: Joao Martins <joao.m.martins@oracle.com>
    Cc: Konrad Dybcio <konradybcio@kernel.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Usama Arif <usama.arif@bytedance.com>
    Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    79359d6d
hugetlb_vmemmap.c 16.9 KB