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>
This commit is contained in:
@@ -1611,9 +1611,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)
|
||||
return NULL;
|
||||
|
||||
area = __get_vm_area_node(size, align, VM_ALLOC, start, end, node,
|
||||
|
||||
Reference in New Issue
Block a user