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:
Jack Cheung
2011-11-29 16:52:49 -08:00
committed by Stephen Boyd
parent 18e44d3eaf
commit f6e34be773
5 changed files with 52 additions and 6 deletions

View File

@@ -105,6 +105,9 @@ unsigned long totalreserve_pages __read_mostly;
*/
unsigned long dirty_balance_reserve __read_mostly;
#ifdef CONFIG_FIX_MOVABLE_ZONE
unsigned long total_unmovable_pages __read_mostly;
#endif
int percpu_pagelist_fraction;
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
@@ -176,6 +179,9 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
};
EXPORT_SYMBOL(totalram_pages);
#ifdef CONFIG_FIX_MOVABLE_ZONE
EXPORT_SYMBOL(total_unmovable_pages);
#endif
static char * const zone_names[MAX_NR_ZONES] = {
#ifdef CONFIG_ZONE_DMA