• Muchun Song's avatar
    mm: hugetlb_vmemmap: improve hugetlb_vmemmap code readability · 6213834c
    Muchun Song authored
    There is a discussion about the name of hugetlb_vmemmap_alloc/free in
    thread [1].  The suggestion suggested by David is rename "alloc/free" to
    "optimize/restore" to make functionalities clearer to users, "optimize"
    means the function will optimize vmemmap pages, while "restore" means
    restoring its vmemmap pages discared before.  This commit does this.
    
    Another discussion is the confusion RESERVE_VMEMMAP_NR isn't used
    explicitly for vmemmap_addr but implicitly for vmemmap_end in
    hugetlb_vmemmap_alloc/free.  David suggested we can compute what
    hugetlb_vmemmap_init() does now at runtime.  We do not need to worry for
    the overhead of computing at runtime since the calculation is simple
    enough and those functions are not in a hot path.  This commit has the
    following improvements:
    
      1) The function suffixed name ("optimize/restore") is more expressive.
      2) The logic becomes less weird in hugetlb_vmemmap_optimize/restore().
      3) The hugetlb_vmemmap_i...
    6213834c
hugetlb_vmemmap.h 1.63 KB