Skip to content

Commit af12346

Browse files
Wanpeng Litorvalds
authored andcommitted
mm/vmalloc: revert "mm/vmalloc.c: check VM_UNINITIALIZED flag in s_show instead of show_numa_info"
The VM_UNINITIALIZED/VM_UNLIST flag introduced by f5252e0 ("mm: avoid null pointer access in vm_struct via /proc/vmallocinfo") is used to avoid accessing the pages field with unallocated page when show_numa_info() is called. This patch moves the check just before show_numa_info in order that some messages still can be dumped via /proc/vmallocinfo. This patch reverts commit d157a55 ("mm/vmalloc.c: check VM_UNINITIALIZED flag in s_show instead of show_numa_info"); Reviewed-by: Zhang Yanfei <[email protected]> Signed-off-by: Wanpeng Li <[email protected]> Cc: Mitsuo Hayasaka <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c2ce8c1 commit af12346

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mm/vmalloc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,6 +2562,11 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
25622562
if (!counters)
25632563
return;
25642564

2565+
/* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
2566+
smp_rmb();
2567+
if (v->flags & VM_UNINITIALIZED)
2568+
return;
2569+
25652570
memset(counters, 0, nr_node_ids * sizeof(unsigned int));
25662571

25672572
for (nr = 0; nr < v->nr_pages; nr++)
@@ -2587,11 +2592,6 @@ static int s_show(struct seq_file *m, void *p)
25872592

25882593
v = va->vm;
25892594

2590-
/* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
2591-
smp_rmb();
2592-
if (v->flags & VM_UNINITIALIZED)
2593-
return 0;
2594-
25952595
seq_printf(m, "0x%pK-0x%pK %7ld",
25962596
v->addr, v->addr + v->size, v->size);
25972597

0 commit comments

Comments
 (0)