]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/vmalloc.c
[PATCH] bootmem: miscellaneous coding style fixes
[linux-2.6-omap-h63xx.git] / mm / vmalloc.c
index 35f8553f893a7ffe0416732827c71385646c4ea3..9aad8b0cc6ee71f5da612d0c4bd79aa8a3fb4476 100644 (file)
@@ -24,6 +24,9 @@
 DEFINE_RWLOCK(vmlist_lock);
 struct vm_struct *vmlist;
 
+static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
+                           int node);
+
 static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end)
 {
        pte_t *pte;
@@ -330,6 +333,8 @@ void __vunmap(void *addr, int deallocate_pages)
                return;
        }
 
+       debug_check_no_locks_freed(addr, area->size);
+
        if (deallocate_pages) {
                int i;
 
@@ -338,7 +343,7 @@ void __vunmap(void *addr, int deallocate_pages)
                        __free_page(area->pages[i]);
                }
 
-               if (area->nr_pages > PAGE_SIZE/sizeof(struct page *))
+               if (area->flags & VM_VPAGES)
                        vfree(area->pages);
                else
                        kfree(area->pages);
@@ -425,9 +430,10 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 
        area->nr_pages = nr_pages;
        /* Please note that the recursion is strictly bounded. */
-       if (array_size > PAGE_SIZE)
+       if (array_size > PAGE_SIZE) {
                pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node);
-       else
+               area->flags |= VM_VPAGES;
+       } else
                pages = kmalloc_node(array_size, (gfp_mask & ~__GFP_HIGHMEM), node);
        area->pages = pages;
        if (!area->pages) {
@@ -475,8 +481,8 @@ void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot)
  *     allocator with @gfp_mask flags.  Map them into contiguous
  *     kernel virtual space, using a pagetable protection of @prot.
  */
-void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
-                       int node)
+static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
+                           int node)
 {
        struct vm_struct *area;
 
@@ -490,7 +496,6 @@ void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
 
        return __vmalloc_area_node(area, gfp_mask, prot, node);
 }
-EXPORT_SYMBOL(__vmalloc_node);
 
 void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
 {