mm: Add total_unmovable_pages global variable
Vmalloc will exit if the amount it needs to allocate is greater than totalram_pages. Vmalloc cannot allocate from the movable zone, so pages in the movable zone should not be counted. This change adds a new global variable: total_unmovable_pages. It is calculated in init.c, based on totalram_pages minus the pages in the movable zone. Vmalloc now looks at this new global instead of totalram_pages. total_unmovable_pages can be modified during memory_hotplug. If the zone you are offlining/onlining is unmovable, then you modify it similar to totalram_pages. If the zone is movable, then no change is needed. Change-Id: Ie55c41051e9ad4b921eb04ecbb4798a8bd2344d6 Signed-off-by: Jack Cheung <jackc@codeaurora.org> (cherry picked from commit 59f9f1c9ae463a3d4499cd9353619f8b1993371b) Conflicts: arch/arm/mm/init.c mm/memory_hotplug.c mm/page_alloc.c mm/vmalloc.c
This commit is contained in:
committed by
Stephen Boyd
parent
18e44d3eaf
commit
f6e34be773
@@ -1647,9 +1647,14 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
|
||||
struct vm_struct *area;
|
||||
void *addr;
|
||||
unsigned long real_size = size;
|
||||
#ifdef CONFIG_FIX_MOVABLE_ZONE
|
||||
unsigned long total_pages = total_unmovable_pages;
|
||||
#else
|
||||
unsigned long total_pages = totalram_pages;
|
||||
#endif
|
||||
|
||||
size = PAGE_ALIGN(size);
|
||||
if (!size || (size >> PAGE_SHIFT) > totalram_pages)
|
||||
if (!size || (size >> PAGE_SHIFT) > total_pages)
|
||||
goto fail;
|
||||
|
||||
area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST,
|
||||
|
||||
Reference in New Issue
Block a user