diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/proc/mmu.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'fs/proc/mmu.c')
-rw-r--r-- | fs/proc/mmu.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/fs/proc/mmu.c b/fs/proc/mmu.c new file mode 100644 index 000000000000..a7041038ad56 --- /dev/null +++ b/fs/proc/mmu.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* mmu.c: mmu memory info files | ||
2 | * | ||
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/time.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/mman.h> | ||
18 | #include <linux/proc_fs.h> | ||
19 | #include <linux/mm.h> | ||
20 | #include <linux/mmzone.h> | ||
21 | #include <linux/pagemap.h> | ||
22 | #include <linux/swap.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/smp.h> | ||
25 | #include <linux/seq_file.h> | ||
26 | #include <linux/hugetlb.h> | ||
27 | #include <linux/vmalloc.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/pgtable.h> | ||
30 | #include <asm/tlb.h> | ||
31 | #include <asm/div64.h> | ||
32 | #include "internal.h" | ||
33 | |||
34 | void get_vmalloc_info(struct vmalloc_info *vmi) | ||
35 | { | ||
36 | struct vm_struct *vma; | ||
37 | unsigned long free_area_size; | ||
38 | unsigned long prev_end; | ||
39 | |||
40 | vmi->used = 0; | ||
41 | |||
42 | if (!vmlist) { | ||
43 | vmi->largest_chunk = VMALLOC_TOTAL; | ||
44 | } | ||
45 | else { | ||
46 | vmi->largest_chunk = 0; | ||
47 | |||
48 | prev_end = VMALLOC_START; | ||
49 | |||
50 | read_lock(&vmlist_lock); | ||
51 | |||
52 | for (vma = vmlist; vma; vma = vma->next) { | ||
53 | vmi->used += vma->size; | ||
54 | |||
55 | free_area_size = (unsigned long) vma->addr - prev_end; | ||
56 | if (vmi->largest_chunk < free_area_size) | ||
57 | vmi->largest_chunk = free_area_size; | ||
58 | |||
59 | prev_end = vma->size + (unsigned long) vma->addr; | ||
60 | } | ||
61 | |||
62 | if (VMALLOC_END - prev_end > vmi->largest_chunk) | ||
63 | vmi->largest_chunk = VMALLOC_END - prev_end; | ||
64 | |||
65 | read_unlock(&vmlist_lock); | ||
66 | } | ||
67 | } | ||