-struct vmalloc_info {
- unsigned long used;
- unsigned long largest_chunk;
-};
-
-static struct vmalloc_info get_vmalloc_info(void)
-{
- unsigned long prev_end = VMALLOC_START;
- struct vm_struct* vma;
- struct vmalloc_info vmi;
- vmi.used = 0;
-
- read_lock(&vmlist_lock);
-
- if(!vmlist)
- vmi.largest_chunk = (VMALLOC_END-VMALLOC_START);
- else
- vmi.largest_chunk = 0;
-
- for (vma = vmlist; vma; vma = vma->next) {
- unsigned long free_area_size =
- (unsigned long)vma->addr - prev_end;
- vmi.used += vma->size;
- if (vmi.largest_chunk < free_area_size )
-
- vmi.largest_chunk = free_area_size;
- prev_end = vma->size + (unsigned long)vma->addr;
- }
- if(VMALLOC_END-prev_end > vmi.largest_chunk)
- vmi.largest_chunk = VMALLOC_END-prev_end;
-
- read_unlock(&vmlist_lock);
- return vmi;
-}
-