summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/vmalloc.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 59aa328..aee1f61 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2671,46 +2671,50 @@ module_init(proc_vmalloc_init);
void get_vmalloc_info(struct vmalloc_info *vmi)
{
- struct vm_struct *vma;
+ struct vmap_area *va;
unsigned long free_area_size;
unsigned long prev_end;
vmi->used = 0;
+ vmi->largest_chunk = 0;
- if (!vmlist) {
- vmi->largest_chunk = VMALLOC_TOTAL;
- } else {
- vmi->largest_chunk = 0;
+ prev_end = VMALLOC_START;
- prev_end = VMALLOC_START;
-
- read_lock(&vmlist_lock);
+ spin_lock(&vmap_area_lock);
- for (vma = vmlist; vma; vma = vma->next) {
- unsigned long addr = (unsigned long) vma->addr;
+ if (list_empty(&vmap_area_list)) {
+ vmi->largest_chunk = VMALLOC_TOTAL;
+ goto out;
+ }
- /*
- * Some archs keep another range for modules in vmlist
- */
- if (addr < VMALLOC_START)
- continue;
- if (addr >= VMALLOC_END)
- break;
+ list_for_each_entry(va, &vmap_area_list, list) {
+ unsigned long addr = va->va_start;
- vmi->used += vma->size;
+ /*
+ * Some archs keep another range for modules in vmalloc space
+ */
+ if (addr < VMALLOC_START)
+ continue;
+ if (addr >= VMALLOC_END)
+ break;
- free_area_size = addr - prev_end;
- if (vmi->largest_chunk < free_area_size)
- vmi->largest_chunk = free_area_size;
+ if (va->flags & (VM_LAZY_FREE | VM_LAZY_FREEING))
+ continue;
- prev_end = vma->size + addr;
- }
+ vmi->used += (va->va_end - va->va_start);
- if (VMALLOC_END - prev_end > vmi->largest_chunk)
- vmi->largest_chunk = VMALLOC_END - prev_end;
+ free_area_size = addr - prev_end;
+ if (vmi->largest_chunk < free_area_size)
+ vmi->largest_chunk = free_area_size;
- read_unlock(&vmlist_lock);
+ prev_end = va->va_end;
}
+
+ if (VMALLOC_END - prev_end > vmi->largest_chunk)
+ vmi->largest_chunk = VMALLOC_END - prev_end;
+
+out:
+ spin_unlock(&vmap_area_lock);
}
#endif