Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm, vmalloc: remove VM_VPAGES

VM_VPAGES is unnecessary, it's easier to check is_vmalloc_addr() when
reading /proc/vmallocinfo.

[akpm@linux-foundation.org: remove VM_VPAGES reference via kvfree()]
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Rientjes and committed by
Linus Torvalds
244d63ee 14669347

+2 -7
-1
include/linux/vmalloc.h
··· 14 14 #define VM_ALLOC 0x00000002 /* vmalloc() */ 15 15 #define VM_MAP 0x00000004 /* vmap()ed pages */ 16 16 #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 17 - #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 18 17 #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ 19 18 #define VM_NO_GUARD 0x00000040 /* don't add guard page */ 20 19 #define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */
+2 -6
mm/vmalloc.c
··· 1479 1479 __free_kmem_pages(page, 0); 1480 1480 } 1481 1481 1482 - if (area->flags & VM_VPAGES) 1483 - vfree(area->pages); 1484 - else 1485 - kfree(area->pages); 1482 + kvfree(area->pages); 1486 1483 } 1487 1484 1488 1485 kfree(area); ··· 1589 1592 if (array_size > PAGE_SIZE) { 1590 1593 pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, 1591 1594 PAGE_KERNEL, node, area->caller); 1592 - area->flags |= VM_VPAGES; 1593 1595 } else { 1594 1596 pages = kmalloc_node(array_size, nested_gfp, node); 1595 1597 } ··· 2646 2650 if (v->flags & VM_USERMAP) 2647 2651 seq_puts(m, " user"); 2648 2652 2649 - if (v->flags & VM_VPAGES) 2653 + if (is_vmalloc_addr(v->pages)) 2650 2654 seq_puts(m, " vpages"); 2651 2655 2652 2656 show_numa_info(m, v);