Skip to content

Commit

Permalink
vmap: cope with vm_unmap_aliases before vmalloc_init()
Browse files Browse the repository at this point in the history
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: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Nov 7, 2008
1 parent 4bab0ea commit 9b46333
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ static void free_unmap_vmap_area_addr(unsigned long addr)

#define VMAP_BLOCK_SIZE (VMAP_BBMAP_BITS * PAGE_SIZE)

static bool vmap_initialized __read_mostly = false;

struct vmap_block_queue {
spinlock_t lock;
struct list_head free;
Expand Down Expand Up @@ -828,6 +830,9 @@ void vm_unmap_aliases(void)
int cpu;
int flush = 0;

if (unlikely(!vmap_initialized))
return;

for_each_possible_cpu(cpu) {
struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
struct vmap_block *vb;
Expand Down Expand Up @@ -942,6 +947,8 @@ void __init vmalloc_init(void)
INIT_LIST_HEAD(&vbq->dirty);
vbq->nr_dirty = 0;
}

vmap_initialized = true;
}

void unmap_kernel_range(unsigned long addr, unsigned long size)
Expand Down

0 comments on commit 9b46333

Please sign in to comment.