arm: ensure enough memory is available for movable zone
If CONFIG_HIGHMEM is enabled, the memory from the movable
zone will come from highmem as the zone of highest
address present is converted to ZONE_MOVABLE, and only
one zone may be used for ZONE_MOVABLE.
Ensure that ZONE_HIGHMEM is large enough for the
movable zone's required size to be created from
it if CONFIG_FIX_MOVABLE_ZONE is enabled as well.
There needs to be a small ZONE_HIGHMEM even after
memory hotremove (due to a generic 3.0 bug), so
extra is reserved for now.
Change-Id: I285c6ad24a6f2f18fc9e6510d379b126f201b082
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 350e5a9..aeaa173 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -791,6 +791,19 @@
{
int i, j, highmem = 0;
+#if (defined CONFIG_HIGHMEM) && (defined CONFIG_FIX_MOVABLE_ZONE)
+
+/* For now, we must ensure that a small highmem zone exists
+ * after most of it is transformed into the movable zone.
+ */
+#define MIN_HIGHMEM_SIZE (5 * SECTION_SIZE)
+ void *v_movable_start;
+
+ v_movable_start = __va(movable_reserved_start) - MIN_HIGHMEM_SIZE;
+
+ if (vmalloc_min > v_movable_start)
+ vmalloc_min = v_movable_start;
+#endif
for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
struct membank *bank = &meminfo.bank[j];
*bank = meminfo.bank[i];