|
@@ -78,142 +78,6 @@ static int proc_calc_metrics(char *page, char **start, off_t off,
|
|
return len;
|
|
return len;
|
|
}
|
|
}
|
|
|
|
|
|
-int __attribute__((weak)) arch_report_meminfo(char *page)
|
|
|
|
-{
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int meminfo_read_proc(char *page, char **start, off_t off,
|
|
|
|
- int count, int *eof, void *data)
|
|
|
|
-{
|
|
|
|
- struct sysinfo i;
|
|
|
|
- int len;
|
|
|
|
- unsigned long committed;
|
|
|
|
- unsigned long allowed;
|
|
|
|
- struct vmalloc_info vmi;
|
|
|
|
- long cached;
|
|
|
|
- unsigned long pages[NR_LRU_LISTS];
|
|
|
|
- int lru;
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * display in kilobytes.
|
|
|
|
- */
|
|
|
|
-#define K(x) ((x) << (PAGE_SHIFT - 10))
|
|
|
|
- si_meminfo(&i);
|
|
|
|
- si_swapinfo(&i);
|
|
|
|
- committed = atomic_long_read(&vm_committed_space);
|
|
|
|
- allowed = ((totalram_pages - hugetlb_total_pages())
|
|
|
|
- * sysctl_overcommit_ratio / 100) + total_swap_pages;
|
|
|
|
-
|
|
|
|
- cached = global_page_state(NR_FILE_PAGES) -
|
|
|
|
- total_swapcache_pages - i.bufferram;
|
|
|
|
- if (cached < 0)
|
|
|
|
- cached = 0;
|
|
|
|
-
|
|
|
|
- get_vmalloc_info(&vmi);
|
|
|
|
-
|
|
|
|
- for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
|
|
|
|
- pages[lru] = global_page_state(NR_LRU_BASE + lru);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * Tagged format, for easy grepping and expansion.
|
|
|
|
- */
|
|
|
|
- len = sprintf(page,
|
|
|
|
- "MemTotal: %8lu kB\n"
|
|
|
|
- "MemFree: %8lu kB\n"
|
|
|
|
- "Buffers: %8lu kB\n"
|
|
|
|
- "Cached: %8lu kB\n"
|
|
|
|
- "SwapCached: %8lu kB\n"
|
|
|
|
- "Active: %8lu kB\n"
|
|
|
|
- "Inactive: %8lu kB\n"
|
|
|
|
- "Active(anon): %8lu kB\n"
|
|
|
|
- "Inactive(anon): %8lu kB\n"
|
|
|
|
- "Active(file): %8lu kB\n"
|
|
|
|
- "Inactive(file): %8lu kB\n"
|
|
|
|
-#ifdef CONFIG_UNEVICTABLE_LRU
|
|
|
|
- "Unevictable: %8lu kB\n"
|
|
|
|
- "Mlocked: %8lu kB\n"
|
|
|
|
-#endif
|
|
|
|
-#ifdef CONFIG_HIGHMEM
|
|
|
|
- "HighTotal: %8lu kB\n"
|
|
|
|
- "HighFree: %8lu kB\n"
|
|
|
|
- "LowTotal: %8lu kB\n"
|
|
|
|
- "LowFree: %8lu kB\n"
|
|
|
|
-#endif
|
|
|
|
- "SwapTotal: %8lu kB\n"
|
|
|
|
- "SwapFree: %8lu kB\n"
|
|
|
|
- "Dirty: %8lu kB\n"
|
|
|
|
- "Writeback: %8lu kB\n"
|
|
|
|
- "AnonPages: %8lu kB\n"
|
|
|
|
- "Mapped: %8lu kB\n"
|
|
|
|
- "Slab: %8lu kB\n"
|
|
|
|
- "SReclaimable: %8lu kB\n"
|
|
|
|
- "SUnreclaim: %8lu kB\n"
|
|
|
|
- "PageTables: %8lu kB\n"
|
|
|
|
-#ifdef CONFIG_QUICKLIST
|
|
|
|
- "Quicklists: %8lu kB\n"
|
|
|
|
-#endif
|
|
|
|
- "NFS_Unstable: %8lu kB\n"
|
|
|
|
- "Bounce: %8lu kB\n"
|
|
|
|
- "WritebackTmp: %8lu kB\n"
|
|
|
|
- "CommitLimit: %8lu kB\n"
|
|
|
|
- "Committed_AS: %8lu kB\n"
|
|
|
|
- "VmallocTotal: %8lu kB\n"
|
|
|
|
- "VmallocUsed: %8lu kB\n"
|
|
|
|
- "VmallocChunk: %8lu kB\n",
|
|
|
|
- K(i.totalram),
|
|
|
|
- K(i.freeram),
|
|
|
|
- K(i.bufferram),
|
|
|
|
- K(cached),
|
|
|
|
- K(total_swapcache_pages),
|
|
|
|
- K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]),
|
|
|
|
- K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]),
|
|
|
|
- K(pages[LRU_ACTIVE_ANON]),
|
|
|
|
- K(pages[LRU_INACTIVE_ANON]),
|
|
|
|
- K(pages[LRU_ACTIVE_FILE]),
|
|
|
|
- K(pages[LRU_INACTIVE_FILE]),
|
|
|
|
-#ifdef CONFIG_UNEVICTABLE_LRU
|
|
|
|
- K(pages[LRU_UNEVICTABLE]),
|
|
|
|
- K(global_page_state(NR_MLOCK)),
|
|
|
|
-#endif
|
|
|
|
-#ifdef CONFIG_HIGHMEM
|
|
|
|
- K(i.totalhigh),
|
|
|
|
- K(i.freehigh),
|
|
|
|
- K(i.totalram-i.totalhigh),
|
|
|
|
- K(i.freeram-i.freehigh),
|
|
|
|
-#endif
|
|
|
|
- K(i.totalswap),
|
|
|
|
- K(i.freeswap),
|
|
|
|
- K(global_page_state(NR_FILE_DIRTY)),
|
|
|
|
- K(global_page_state(NR_WRITEBACK)),
|
|
|
|
- K(global_page_state(NR_ANON_PAGES)),
|
|
|
|
- K(global_page_state(NR_FILE_MAPPED)),
|
|
|
|
- K(global_page_state(NR_SLAB_RECLAIMABLE) +
|
|
|
|
- global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
|
|
|
- K(global_page_state(NR_SLAB_RECLAIMABLE)),
|
|
|
|
- K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
|
|
|
- K(global_page_state(NR_PAGETABLE)),
|
|
|
|
-#ifdef CONFIG_QUICKLIST
|
|
|
|
- K(quicklist_total_size()),
|
|
|
|
-#endif
|
|
|
|
- K(global_page_state(NR_UNSTABLE_NFS)),
|
|
|
|
- K(global_page_state(NR_BOUNCE)),
|
|
|
|
- K(global_page_state(NR_WRITEBACK_TEMP)),
|
|
|
|
- K(allowed),
|
|
|
|
- K(committed),
|
|
|
|
- (unsigned long)VMALLOC_TOTAL >> 10,
|
|
|
|
- vmi.used >> 10,
|
|
|
|
- vmi.largest_chunk >> 10
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- len += hugetlb_report_meminfo(page + len);
|
|
|
|
-
|
|
|
|
- len += arch_report_meminfo(page + len);
|
|
|
|
-
|
|
|
|
- return proc_calc_metrics(page, start, off, count, eof, len);
|
|
|
|
-#undef K
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int fragmentation_open(struct inode *inode, struct file *file)
|
|
static int fragmentation_open(struct inode *inode, struct file *file)
|
|
{
|
|
{
|
|
(void)inode;
|
|
(void)inode;
|
|
@@ -816,7 +680,6 @@ void __init proc_misc_init(void)
|
|
char *name;
|
|
char *name;
|
|
int (*read_proc)(char*,char**,off_t,int,int*,void*);
|
|
int (*read_proc)(char*,char**,off_t,int,int*,void*);
|
|
} *p, simple_ones[] = {
|
|
} *p, simple_ones[] = {
|
|
- {"meminfo", meminfo_read_proc},
|
|
|
|
{"version", version_read_proc},
|
|
{"version", version_read_proc},
|
|
#ifdef CONFIG_PROC_HARDWARE
|
|
#ifdef CONFIG_PROC_HARDWARE
|
|
{"hardware", hardware_read_proc},
|
|
{"hardware", hardware_read_proc},
|