Skip to content

Commit d157a55

Browse files
Zhang Yanfeitorvalds
authored andcommitted
mm/vmalloc.c: check VM_UNINITIALIZED flag in s_show instead of show_numa_info
We should check the VM_UNITIALIZED flag in s_show(). If this flag is set, that said, the vm_struct is not fully initialized. So it is unnecessary to try to show the information contained in vm_struct. We checked this flag in show_numa_info(), but I think it's better to check it earlier. Signed-off-by: Zhang Yanfei <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 20fc02b commit d157a55

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
@@ -2569,11 +2569,6 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
25692569
if (!counters)
25702570
return;
25712571

2572-
/* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
2573-
smp_rmb();
2574-
if (v->flags & VM_UNINITIALIZED)
2575-
return;
2576-
25772572
memset(counters, 0, nr_node_ids * sizeof(unsigned int));
25782573

25792574
for (nr = 0; nr < v->nr_pages; nr++)
@@ -2602,6 +2597,11 @@ static int s_show(struct seq_file *m, void *p)
26022597

26032598
v = va->vm;
26042599

2600+
/* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
2601+
smp_rmb();
2602+
if (v->flags & VM_UNINITIALIZED)
2603+
return 0;
2604+
26052605
seq_printf(m, "0x%pK-0x%pK %7ld",
26062606
v->addr, v->addr + v->size, v->size);
26072607

0 commit comments

Comments
 (0)