• Anshuman Khandual's avatar
    mm/page_alloc: add alloc_contig_pages() · 5e27a2df
    Anshuman Khandual authored
    HugeTLB helper alloc_gigantic_page() implements fairly generic
    allocation method where it scans over various zones looking for a large
    contiguous pfn range before trying to allocate it with
    alloc_contig_range().
    
    Other than deriving the requested order from 'struct hstate', there is
    nothing HugeTLB specific in there.  This can be made available for
    general use to allocate contiguous memory which could not have been
    allocated through the buddy allocator.
    
    alloc_gigantic_page() has been split carving out actual allocation
    method which is then made available via new alloc_contig_pages() helper
    wrapped under CONFIG_CONTIG_ALLOC.  All references to 'gigantic' have
    been replaced with more generic term 'contig'.  Allocated pages here
    should be freed with free_contig_range() or by calling __free_page() on
    each allocated page.
    
    Link: http://lkml.kernel.org/r/1571300646-32240-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: David Hildenbrand <david@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    5e27a2df
hugetlb.c 136 KB