Commit 9b463334 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar

vmap: cope with vm_unmap_aliases before vmalloc_init()

Xen can end up calling vm_unmap_aliases() before vmalloc_init() has
been called.  In this case its safe to make it a simple no-op.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4bab0ea1
...@@ -592,6 +592,8 @@ static void free_unmap_vmap_area_addr(unsigned long addr) ...@@ -592,6 +592,8 @@ static void free_unmap_vmap_area_addr(unsigned long addr)
#define VMAP_BLOCK_SIZE (VMAP_BBMAP_BITS * PAGE_SIZE) #define VMAP_BLOCK_SIZE (VMAP_BBMAP_BITS * PAGE_SIZE)
static bool vmap_initialized __read_mostly = false;
struct vmap_block_queue { struct vmap_block_queue {
spinlock_t lock; spinlock_t lock;
struct list_head free; struct list_head free;
...@@ -828,6 +830,9 @@ void vm_unmap_aliases(void) ...@@ -828,6 +830,9 @@ void vm_unmap_aliases(void)
int cpu; int cpu;
int flush = 0; int flush = 0;
if (unlikely(!vmap_initialized))
return;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu); struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
struct vmap_block *vb; struct vmap_block *vb;
...@@ -942,6 +947,8 @@ void __init vmalloc_init(void) ...@@ -942,6 +947,8 @@ void __init vmalloc_init(void)
INIT_LIST_HEAD(&vbq->dirty); INIT_LIST_HEAD(&vbq->dirty);
vbq->nr_dirty = 0; vbq->nr_dirty = 0;
} }
vmap_initialized = true;
} }
void unmap_kernel_range(unsigned long addr, unsigned long size) void unmap_kernel_range(unsigned long addr, unsigned long size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment