Skip to content
  • Michal Hocko's avatar
    mm, hugetlb: unify core page allocation accounting and initialization · af0fb9df
    Michal Hocko authored
    Patch series "mm, hugetlb: allocation API and migration improvements"
    
    Motivation:
    
    this is a follow up for [3] for the allocation API and [4] for the
    hugetlb migration.  It wasn't really easy to split those into two
    separate patch series as they share some code.
    
    My primary motivation to touch this code is to make the gigantic pages
    migration working.  The giga pages allocation code is just too fragile
    and hacked into the hugetlb code now.  This series tries to move giga
    pages closer to the first class citizen.  We are not there yet but
    having 5 patches is quite a lot already and it will already make the
    code much easier to follow.  I will come with other changes on top after
    this sees some review.
    
    The first two patches should be trivial to review.  The third patch
    changes the way how we migrate huge pages.  Newly allocated pages are a
    subject of the overcommit check and they participate surplus accounting
    which is quite unfortunate as the changelog explains.  This patch
    doesn't change anything wrt.  giga pages.
    
    Patch #4 removes the surplus accounting hack from
    __alloc_surplus_huge_page.  I hope I didn't miss anything there and a
    deeper review is really due there.
    
    Patch #5 finally unifies allocation paths and giga pages shouldn't be
    any special anymore.  There is also some renaming going on as well.
    
    This patch (of 6):
    
    hugetlb allocator has two entry points to the page allocator
     - alloc_fresh_huge_page_node
     - __hugetlb_alloc_buddy_huge_page
    
    The two differ very subtly in two aspects.  The first one doesn't care
    about HTLB_BUDDY_* stats and it doesn't initialize the huge page.
    prep_new_huge_page is not used because it not only initializes hugetlb
    specific stuff but because it also put_page and releases the page to the
    hugetlb pool which is not what is required in some contexts.  This makes
    things more complicated than necessary.
    
    Simplify things by a) removing the page allocator entry point duplicity
    and only keep __hugetlb_alloc_buddy_huge_page and b) make
    prep_new_huge_page more reusable by removing the put_page which moves
    the page to the allocator pool.  All current callers are updated to call
    put_page explicitly.  Later patches will add new callers which won't
    need it.
    
    This patch shouldn't introduce any functional change.
    
    Link: http://lkml.kernel.org/r/20180103093213.26329-2-mhocko@kernel.org
    
    
    Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
    Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Andrea Reale <ar@linux.vnet.ibm.com>
    Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Zi Yan <zi.yan@cs.rutgers.edu>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    af0fb9df