]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/vmalloc.c
vmap: cope with vm_unmap_aliases before vmalloc_init()
[linux-2.6-omap-h63xx.git] / mm / vmalloc.c
index 036536945dd9e06f53adf21c165f087a4700c3cc..ba6b0f5f7fac6dcce7a9e8a7c71f00e0e691d193 100644 (file)
@@ -178,7 +178,7 @@ static int vmap_page_range(unsigned long addr, unsigned long end,
 static inline int is_vmalloc_or_module_addr(const void *x)
 {
        /*
-        * x86-64 and sparc64 put modules in a special place,
+        * ARM, x86-64 and sparc64 put modules in a special place,
         * and fall back on vmalloc() if that fails. Others
         * just put it in the vmalloc space.
         */
@@ -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;
@@ -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;
@@ -897,7 +902,8 @@ EXPORT_SYMBOL(vm_unmap_ram);
  * @count: number of pages
  * @node: prefer to allocate data structures on this node
  * @prot: memory protection to use. PAGE_KERNEL for regular RAM
- * @returns: a pointer to the address that has been mapped, or NULL on failure
+ *
+ * Returns: a pointer to the address that has been mapped, or %NULL on failure
  */
 void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot)
 {
@@ -941,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)