mm/page_alloc: add alloc_contig_pages()
Subsystems (4)
[email protected]
maintainerPATCH 97/158 mm/page_alloc: add alloc_contig_pages()
From: Anshuman Khandual <[email protected]>
Subject: mm/page_alloc: add alloc_contig_pages()
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.
---
include/linux/gfp.h | 2 mm/hugetlb.c | 77 -------------------------------- mm/page_alloc.c | 101 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 75 deletions(-)
include/linux/gfp.h renamed from include/linux/gfp.h~mm-page_alloc-add-alloc_contig_pages +2 -0
@@ -612,6 +612,8 @@ static inline bool pm_suspended_storage(/* The below functions must be run on a range from a single zone. */ extern int alloc_contig_range (unsigned long start,unsigned long end,unsigned migratetype,gfp_t gfp_mask); +extern struct page *alloc_contig_pages (unsigned long nr_pages,gfp_t gfp_mask, +int nid,nodemask_t *nodemask);#endif void free_contig_range (unsigned long pfn,unsigned int nr_pages);
mm/hugetlb.c renamed from mm/hugetlb.c~mm-page_alloc-add-alloc_contig_pages +2 -75
87 lines not on this page · raw message
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-add-alloc_contig_pages +101 -0
107 lines not on this page · raw message
_