mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-21 17:00:01 +00:00
64d13c00cf
VmallocTotal: 34359738367 kB VmallocUsed: 266288 kB VmallocChunk: 18014366299193295 kB is unsettling - x86_64 and some other architectures keep a separate address range for modules in vmalloc's vmlist, which /proc/meminfo should pass over. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
78 lines
1.8 KiB
C
78 lines
1.8 KiB
C
/* mmu.c: mmu memory info files
|
|
*
|
|
* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/time.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/string.h>
|
|
#include <linux/mman.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/mmzone.h>
|
|
#include <linux/pagemap.h>
|
|
#include <linux/swap.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/hugetlb.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <asm/uaccess.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/tlb.h>
|
|
#include <asm/div64.h>
|
|
#include "internal.h"
|
|
|
|
void get_vmalloc_info(struct vmalloc_info *vmi)
|
|
{
|
|
struct vm_struct *vma;
|
|
unsigned long free_area_size;
|
|
unsigned long prev_end;
|
|
|
|
vmi->used = 0;
|
|
|
|
if (!vmlist) {
|
|
vmi->largest_chunk = VMALLOC_TOTAL;
|
|
}
|
|
else {
|
|
vmi->largest_chunk = 0;
|
|
|
|
prev_end = VMALLOC_START;
|
|
|
|
read_lock(&vmlist_lock);
|
|
|
|
for (vma = vmlist; vma; vma = vma->next) {
|
|
unsigned long addr = (unsigned long) vma->addr;
|
|
|
|
/*
|
|
* Some archs keep another range for modules in vmlist
|
|
*/
|
|
if (addr < VMALLOC_START)
|
|
continue;
|
|
if (addr >= VMALLOC_END)
|
|
break;
|
|
|
|
vmi->used += vma->size;
|
|
|
|
free_area_size = addr - prev_end;
|
|
if (vmi->largest_chunk < free_area_size)
|
|
vmi->largest_chunk = free_area_size;
|
|
|
|
prev_end = vma->size + addr;
|
|
}
|
|
|
|
if (VMALLOC_END - prev_end > vmi->largest_chunk)
|
|
vmi->largest_chunk = VMALLOC_END - prev_end;
|
|
|
|
read_unlock(&vmlist_lock);
|
|
}
|
|
}
|