aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/vmalloc.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f2481cb4e6b2..e73948afac70 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2574,32 +2574,13 @@ void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
2574static void *s_start(struct seq_file *m, loff_t *pos) 2574static void *s_start(struct seq_file *m, loff_t *pos)
2575 __acquires(&vmap_area_lock) 2575 __acquires(&vmap_area_lock)
2576{ 2576{
2577 loff_t n = *pos;
2578 struct vmap_area *va;
2579
2580 spin_lock(&vmap_area_lock); 2577 spin_lock(&vmap_area_lock);
2581 va = list_first_entry(&vmap_area_list, typeof(*va), list); 2578 return seq_list_start(&vmap_area_list, *pos);
2582 while (n > 0 && &va->list != &vmap_area_list) {
2583 n--;
2584 va = list_next_entry(va, list);
2585 }
2586 if (!n && &va->list != &vmap_area_list)
2587 return va;
2588
2589 return NULL;
2590
2591} 2579}
2592 2580
2593static void *s_next(struct seq_file *m, void *p, loff_t *pos) 2581static void *s_next(struct seq_file *m, void *p, loff_t *pos)
2594{ 2582{
2595 struct vmap_area *va = p, *next; 2583 return seq_list_next(p, &vmap_area_list, pos);
2596
2597 ++*pos;
2598 next = list_next_entry(va, list);
2599 if (&next->list != &vmap_area_list)
2600 return next;
2601
2602 return NULL;
2603} 2584}
2604 2585
2605static void s_stop(struct seq_file *m, void *p) 2586static void s_stop(struct seq_file *m, void *p)
@@ -2634,9 +2615,11 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
2634 2615
2635static int s_show(struct seq_file *m, void *p) 2616static int s_show(struct seq_file *m, void *p)
2636{ 2617{
2637 struct vmap_area *va = p; 2618 struct vmap_area *va;
2638 struct vm_struct *v; 2619 struct vm_struct *v;
2639 2620
2621 va = list_entry(p, struct vmap_area, list);
2622
2640 /* 2623 /*
2641 * s_show can encounter race with remove_vm_area, !VM_VM_AREA on 2624 * s_show can encounter race with remove_vm_area, !VM_VM_AREA on
2642 * behalf of vmap area is being tear down or vm_map_ram allocation. 2625 * behalf of vmap area is being tear down or vm_map_ram allocation.