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

mm/vmalloc.c: rename VM_UNLIST to VM_UNINITIALIZED

VM_UNLIST was used to indicate that the vm_struct is not listed in
vmlist.

But after commit 4341fa454796 ("mm, vmalloc: remove list management of
vmlist after initializing vmalloc"), the meaning of this flag changed.
It now means the vm_struct is not fully initialized. So renaming it to
VM_UNINITIALIZED seems more reasonable.

Also change clear_vm_unlist to clear_vm_uninitialized_flag.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Zhang Yanfei and committed by
Linus Torvalds
20fc02b4 46c001a2

+15 -15
+6 -6
include/linux/vmalloc.h
··· 10 10 struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 11 11 12 12 /* bits in flags of vmalloc's vm_struct below */ 13 - #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 14 - #define VM_ALLOC 0x00000002 /* vmalloc() */ 15 - #define VM_MAP 0x00000004 /* vmap()ed pages */ 16 - #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 17 - #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 18 - #define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */ 13 + #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 14 + #define VM_ALLOC 0x00000002 /* vmalloc() */ 15 + #define VM_MAP 0x00000004 /* vmap()ed pages */ 16 + #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 17 + #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 18 + #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ 19 19 /* bits [20..32] reserved for arch specific ioremap internals */ 20 20 21 21 /*
+9 -9
mm/vmalloc.c
··· 1289 1289 spin_unlock(&vmap_area_lock); 1290 1290 } 1291 1291 1292 - static void clear_vm_unlist(struct vm_struct *vm) 1292 + static void clear_vm_uninitialized_flag(struct vm_struct *vm) 1293 1293 { 1294 1294 /* 1295 - * Before removing VM_UNLIST, 1295 + * Before removing VM_UNINITIALIZED, 1296 1296 * we should make sure that vm has proper values. 1297 1297 * Pair with smp_rmb() in show_numa_info(). 1298 1298 */ 1299 1299 smp_wmb(); 1300 - vm->flags &= ~VM_UNLIST; 1300 + vm->flags &= ~VM_UNINITIALIZED; 1301 1301 } 1302 1302 1303 1303 static struct vm_struct *__get_vm_area_node(unsigned long size, ··· 1635 1635 if (!size || (size >> PAGE_SHIFT) > totalram_pages) 1636 1636 goto fail; 1637 1637 1638 - area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST, 1638 + area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNINITIALIZED, 1639 1639 start, end, node, gfp_mask, caller); 1640 1640 if (!area) 1641 1641 goto fail; ··· 1645 1645 goto fail; 1646 1646 1647 1647 /* 1648 - * In this function, newly allocated vm_struct has VM_UNLIST flag. 1649 - * It means that vm_struct is not fully initialized. 1648 + * In this function, newly allocated vm_struct has VM_UNINITIALIZED 1649 + * flag. It means that vm_struct is not fully initialized. 1650 1650 * Now, it is fully initialized, so remove this flag here. 1651 1651 */ 1652 - clear_vm_unlist(area); 1652 + clear_vm_uninitialized_flag(area); 1653 1653 1654 1654 /* 1655 1655 * A ref_count = 3 is needed because the vm_struct and vmap_area ··· 2569 2569 if (!counters) 2570 2570 return; 2571 2571 2572 - /* Pair with smp_wmb() in clear_vm_unlist() */ 2572 + /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */ 2573 2573 smp_rmb(); 2574 - if (v->flags & VM_UNLIST) 2574 + if (v->flags & VM_UNINITIALIZED) 2575 2575 return; 2576 2576 2577 2577 memset(counters, 0, nr_node_ids * sizeof(unsigned int));