2008-10-15 23:50:22 +04:00
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/mm.h>
|
2013-11-15 02:31:02 +04:00
|
|
|
#include <linux/hugetlb.h>
|
2008-10-15 23:50:22 +04:00
|
|
|
#include <linux/mman.h>
|
|
|
|
#include <linux/mmzone.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/quicklist.h>
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/swap.h>
|
|
|
|
#include <linux/vmstat.h>
|
2011-07-27 03:09:06 +04:00
|
|
|
#include <linux/atomic.h>
|
2013-04-30 02:07:28 +04:00
|
|
|
#include <linux/vmalloc.h>
|
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo.
Currently, in a CMA enabled system, if somebody wants to know the total
CMA size declared, there is no way to tell, other than the dmesg or
/var/log/messages logs.
With this patch we are showing the CMA info as part of meminfo, so that it
can be determined at any point of time. This will be populated only when
CMA is enabled.
Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB.
MemTotal: 471172 kB
MemFree: 111712 kB
MemAvailable: 271172 kB
.
.
.
CmaTotal: 16384 kB
CmaFree: 6144 kB
This patch also fix below checkpatch errors that were found during these changes.
ERROR: space required after that ',' (ctx:ExV)
199: FILE: fs/proc/meminfo.c:199:
+ ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
^
ERROR: space required after that ',' (ctx:ExV)
202: FILE: fs/proc/meminfo.c:202:
+ ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
^
ERROR: space required after that ',' (ctx:ExV)
206: FILE: fs/proc/meminfo.c:206:
+ ,K(totalcma_pages)
^
total: 3 errors, 0 warnings, 2 checks, 236 lines checked
Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-19 03:17:18 +03:00
|
|
|
#ifdef CONFIG_CMA
|
|
|
|
#include <linux/cma.h>
|
|
|
|
#endif
|
2008-10-15 23:50:22 +04:00
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static int meminfo_proc_show(struct seq_file *m, void *v)
|
|
|
|
{
|
|
|
|
struct sysinfo i;
|
|
|
|
unsigned long committed;
|
|
|
|
long cached;
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
long available;
|
|
|
|
unsigned long pagecache;
|
|
|
|
unsigned long wmark_low = 0;
|
2008-10-15 23:50:22 +04:00
|
|
|
unsigned long pages[NR_LRU_LISTS];
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
struct zone *zone;
|
2008-10-15 23:50:22 +04:00
|
|
|
int lru;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* display in kilobytes.
|
|
|
|
*/
|
|
|
|
#define K(x) ((x) << (PAGE_SHIFT - 10))
|
|
|
|
si_meminfo(&i);
|
|
|
|
si_swapinfo(&i);
|
2009-05-01 02:08:51 +04:00
|
|
|
committed = percpu_counter_read_positive(&vm_committed_as);
|
2008-10-15 23:50:22 +04:00
|
|
|
|
|
|
|
cached = global_page_state(NR_FILE_PAGES) -
|
2013-02-23 04:34:37 +04:00
|
|
|
total_swapcache_pages() - i.bufferram;
|
2008-10-15 23:50:22 +04:00
|
|
|
if (cached < 0)
|
|
|
|
cached = 0;
|
|
|
|
|
|
|
|
for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
|
|
|
|
pages[lru] = global_page_state(NR_LRU_BASE + lru);
|
|
|
|
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
for_each_zone(zone)
|
|
|
|
wmark_low += zone->watermark[WMARK_LOW];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Estimate the amount of memory available for userspace allocations,
|
|
|
|
* without causing swapping.
|
|
|
|
*
|
|
|
|
* Free memory cannot be taken below the low watermark, before the
|
|
|
|
* system starts swapping.
|
|
|
|
*/
|
|
|
|
available = i.freeram - wmark_low;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Not all the page cache can be freed, otherwise the system will
|
|
|
|
* start swapping. Assume at least half of the page cache, or the
|
|
|
|
* low watermark worth of cache, needs to stay.
|
|
|
|
*/
|
|
|
|
pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE];
|
|
|
|
pagecache -= min(pagecache / 2, wmark_low);
|
|
|
|
available += pagecache;
|
|
|
|
|
|
|
|
/*
|
2014-04-08 02:38:32 +04:00
|
|
|
* Part of the reclaimable slab consists of items that are in use,
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
* and cannot be freed. Cap this estimate at the low watermark.
|
|
|
|
*/
|
|
|
|
available += global_page_state(NR_SLAB_RECLAIMABLE) -
|
|
|
|
min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low);
|
|
|
|
|
|
|
|
if (available < 0)
|
|
|
|
available = 0;
|
|
|
|
|
2008-10-15 23:50:22 +04:00
|
|
|
/*
|
|
|
|
* Tagged format, for easy grepping and expansion.
|
|
|
|
*/
|
|
|
|
seq_printf(m,
|
|
|
|
"MemTotal: %8lu kB\n"
|
|
|
|
"MemFree: %8lu kB\n"
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
"MemAvailable: %8lu kB\n"
|
2008-10-15 23:50:22 +04:00
|
|
|
"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"
|
|
|
|
"Unevictable: %8lu kB\n"
|
|
|
|
"Mlocked: %8lu kB\n"
|
|
|
|
#ifdef CONFIG_HIGHMEM
|
|
|
|
"HighTotal: %8lu kB\n"
|
|
|
|
"HighFree: %8lu kB\n"
|
|
|
|
"LowTotal: %8lu kB\n"
|
|
|
|
"LowFree: %8lu kB\n"
|
2009-01-08 15:04:47 +03:00
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_MMU
|
|
|
|
"MmapCopy: %8lu kB\n"
|
2008-10-15 23:50:22 +04:00
|
|
|
#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"
|
2009-09-22 04:01:33 +04:00
|
|
|
"Shmem: %8lu kB\n"
|
2008-10-15 23:50:22 +04:00
|
|
|
"Slab: %8lu kB\n"
|
|
|
|
"SReclaimable: %8lu kB\n"
|
|
|
|
"SUnreclaim: %8lu kB\n"
|
2009-09-22 04:01:32 +04:00
|
|
|
"KernelStack: %8lu kB\n"
|
2008-10-15 23:50:22 +04:00
|
|
|
"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"
|
2009-09-16 13:50:15 +04:00
|
|
|
"VmallocChunk: %8lu kB\n"
|
|
|
|
#ifdef CONFIG_MEMORY_FAILURE
|
2009-10-27 02:49:32 +03:00
|
|
|
"HardwareCorrupted: %5lu kB\n"
|
2011-01-14 02:46:58 +03:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
|
|
|
"AnonHugePages: %8lu kB\n"
|
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo.
Currently, in a CMA enabled system, if somebody wants to know the total
CMA size declared, there is no way to tell, other than the dmesg or
/var/log/messages logs.
With this patch we are showing the CMA info as part of meminfo, so that it
can be determined at any point of time. This will be populated only when
CMA is enabled.
Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB.
MemTotal: 471172 kB
MemFree: 111712 kB
MemAvailable: 271172 kB
.
.
.
CmaTotal: 16384 kB
CmaFree: 6144 kB
This patch also fix below checkpatch errors that were found during these changes.
ERROR: space required after that ',' (ctx:ExV)
199: FILE: fs/proc/meminfo.c:199:
+ ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
^
ERROR: space required after that ',' (ctx:ExV)
202: FILE: fs/proc/meminfo.c:202:
+ ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
^
ERROR: space required after that ',' (ctx:ExV)
206: FILE: fs/proc/meminfo.c:206:
+ ,K(totalcma_pages)
^
total: 3 errors, 0 warnings, 2 checks, 236 lines checked
Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-19 03:17:18 +03:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CMA
|
|
|
|
"CmaTotal: %8lu kB\n"
|
|
|
|
"CmaFree: %8lu kB\n"
|
2009-09-16 13:50:15 +04:00
|
|
|
#endif
|
|
|
|
,
|
2008-10-15 23:50:22 +04:00
|
|
|
K(i.totalram),
|
|
|
|
K(i.freeram),
|
/proc/meminfo: provide estimated available memory
Many load balancing and workload placing programs check /proc/meminfo to
estimate how much free memory is available. They generally do this by
adding up "free" and "cached", which was fine ten years ago, but is
pretty much guaranteed to be wrong today.
It is wrong because Cached includes memory that is not freeable as page
cache, for example shared memory segments, tmpfs, and ramfs, and it does
not include reclaimable slab memory, which can take up a large fraction
of system memory on mostly idle systems with lots of files.
Currently, the amount of memory that is available for a new workload,
without pushing the system into swap, can be estimated from MemFree,
Active(file), Inactive(file), and SReclaimable, as well as the "low"
watermarks from /proc/zoneinfo.
However, this may change in the future, and user space really should not
be expected to know kernel internals to come up with an estimate for the
amount of free memory.
It is more convenient to provide such an estimate in /proc/meminfo. If
things change in the future, we only have to change it in one place.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Erik Mouw <erik.mouw_2@nxp.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-22 03:49:05 +04:00
|
|
|
K(available),
|
2008-10-15 23:50:22 +04:00
|
|
|
K(i.bufferram),
|
|
|
|
K(cached),
|
2013-02-23 04:34:37 +04:00
|
|
|
K(total_swapcache_pages()),
|
2008-10-15 23:50:22 +04:00
|
|
|
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]),
|
|
|
|
K(pages[LRU_UNEVICTABLE]),
|
|
|
|
K(global_page_state(NR_MLOCK)),
|
|
|
|
#ifdef CONFIG_HIGHMEM
|
|
|
|
K(i.totalhigh),
|
|
|
|
K(i.freehigh),
|
|
|
|
K(i.totalram-i.totalhigh),
|
|
|
|
K(i.freeram-i.freehigh),
|
2009-01-08 15:04:47 +03:00
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_MMU
|
2009-04-03 03:56:32 +04:00
|
|
|
K((unsigned long) atomic_long_read(&mmap_pages_allocated)),
|
2008-10-15 23:50:22 +04:00
|
|
|
#endif
|
|
|
|
K(i.totalswap),
|
|
|
|
K(i.freeswap),
|
|
|
|
K(global_page_state(NR_FILE_DIRTY)),
|
|
|
|
K(global_page_state(NR_WRITEBACK)),
|
2011-12-09 02:33:56 +04:00
|
|
|
K(global_page_state(NR_ANON_PAGES)),
|
2008-10-15 23:50:22 +04:00
|
|
|
K(global_page_state(NR_FILE_MAPPED)),
|
2014-08-07 03:06:38 +04:00
|
|
|
K(i.sharedram),
|
2008-10-15 23:50:22 +04:00
|
|
|
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)),
|
2009-09-22 04:01:32 +04:00
|
|
|
global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024,
|
2008-10-15 23:50:22 +04:00
|
|
|
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)),
|
2013-11-13 03:08:31 +04:00
|
|
|
K(vm_commit_limit()),
|
2008-10-15 23:50:22 +04:00
|
|
|
K(committed),
|
|
|
|
(unsigned long)VMALLOC_TOTAL >> 10,
|
mm: get rid of 'vmalloc_info' from /proc/meminfo
It turns out that at least some versions of glibc end up reading
/proc/meminfo at every single startup, because glibc wants to know the
amount of memory the machine has. And while that's arguably insane,
it's just how things are.
And it turns out that it's not all that expensive most of the time, but
the vmalloc information statistics (amount of virtual memory used in the
vmalloc space, and the biggest remaining chunk) can be rather expensive
to compute.
The 'get_vmalloc_info()' function actually showed up on my profiles as
4% of the CPU usage of "make test" in the git source repository, because
the git tests are lots of very short-lived shell-scripts etc.
It turns out that apparently this same silly vmalloc info gathering
shows up on the facebook servers too, according to Dave Jones. So it's
not just "make test" for git.
We had two patches to just cache the information (one by me, one by
Ingo) to mitigate this issue, but the whole vmalloc information of of
rather dubious value to begin with, and people who *actually* want to
know what the situation is wrt the vmalloc area should just look at the
much more complete /proc/vmallocinfo instead.
In fact, according to my testing - and perhaps more importantly,
according to that big search engine in the sky: Google - there is
nothing out there that actually cares about those two expensive fields:
VmallocUsed and VmallocChunk.
So let's try to just remove them entirely. Actually, this just removes
the computation and reports the numbers as zero for now, just to try to
be minimally intrusive.
If this breaks anything, we'll obviously have to re-introduce the code
to compute this all and add the caching patches on top. But if given
the option, I'd really prefer to just remove this bad idea entirely
rather than add even more code to work around our historical mistake
that likely nobody really cares about.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-02 04:09:15 +03:00
|
|
|
0ul, // used to be vmalloc 'used'
|
|
|
|
0ul // used to be vmalloc 'largest_chunk'
|
2009-09-16 13:50:15 +04:00
|
|
|
#ifdef CONFIG_MEMORY_FAILURE
|
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo.
Currently, in a CMA enabled system, if somebody wants to know the total
CMA size declared, there is no way to tell, other than the dmesg or
/var/log/messages logs.
With this patch we are showing the CMA info as part of meminfo, so that it
can be determined at any point of time. This will be populated only when
CMA is enabled.
Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB.
MemTotal: 471172 kB
MemFree: 111712 kB
MemAvailable: 271172 kB
.
.
.
CmaTotal: 16384 kB
CmaFree: 6144 kB
This patch also fix below checkpatch errors that were found during these changes.
ERROR: space required after that ',' (ctx:ExV)
199: FILE: fs/proc/meminfo.c:199:
+ ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
^
ERROR: space required after that ',' (ctx:ExV)
202: FILE: fs/proc/meminfo.c:202:
+ ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
^
ERROR: space required after that ',' (ctx:ExV)
206: FILE: fs/proc/meminfo.c:206:
+ ,K(totalcma_pages)
^
total: 3 errors, 0 warnings, 2 checks, 236 lines checked
Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-19 03:17:18 +03:00
|
|
|
, atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
|
2011-01-14 02:46:58 +03:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo.
Currently, in a CMA enabled system, if somebody wants to know the total
CMA size declared, there is no way to tell, other than the dmesg or
/var/log/messages logs.
With this patch we are showing the CMA info as part of meminfo, so that it
can be determined at any point of time. This will be populated only when
CMA is enabled.
Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB.
MemTotal: 471172 kB
MemFree: 111712 kB
MemAvailable: 271172 kB
.
.
.
CmaTotal: 16384 kB
CmaFree: 6144 kB
This patch also fix below checkpatch errors that were found during these changes.
ERROR: space required after that ',' (ctx:ExV)
199: FILE: fs/proc/meminfo.c:199:
+ ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
^
ERROR: space required after that ',' (ctx:ExV)
202: FILE: fs/proc/meminfo.c:202:
+ ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
^
ERROR: space required after that ',' (ctx:ExV)
206: FILE: fs/proc/meminfo.c:206:
+ ,K(totalcma_pages)
^
total: 3 errors, 0 warnings, 2 checks, 236 lines checked
Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-19 03:17:18 +03:00
|
|
|
, K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
|
2011-01-14 02:46:58 +03:00
|
|
|
HPAGE_PMD_NR)
|
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo.
Currently, in a CMA enabled system, if somebody wants to know the total
CMA size declared, there is no way to tell, other than the dmesg or
/var/log/messages logs.
With this patch we are showing the CMA info as part of meminfo, so that it
can be determined at any point of time. This will be populated only when
CMA is enabled.
Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB.
MemTotal: 471172 kB
MemFree: 111712 kB
MemAvailable: 271172 kB
.
.
.
CmaTotal: 16384 kB
CmaFree: 6144 kB
This patch also fix below checkpatch errors that were found during these changes.
ERROR: space required after that ',' (ctx:ExV)
199: FILE: fs/proc/meminfo.c:199:
+ ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
^
ERROR: space required after that ',' (ctx:ExV)
202: FILE: fs/proc/meminfo.c:202:
+ ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
^
ERROR: space required after that ',' (ctx:ExV)
206: FILE: fs/proc/meminfo.c:206:
+ ,K(totalcma_pages)
^
total: 3 errors, 0 warnings, 2 checks, 236 lines checked
Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-19 03:17:18 +03:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CMA
|
|
|
|
, K(totalcma_pages)
|
|
|
|
, K(global_page_state(NR_FREE_CMA_PAGES))
|
2009-09-16 13:50:15 +04:00
|
|
|
#endif
|
2008-10-15 23:50:22 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
hugetlb_report_meminfo(m);
|
|
|
|
|
|
|
|
arch_report_meminfo(m);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
#undef K
|
|
|
|
}
|
|
|
|
|
|
|
|
static int meminfo_proc_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return single_open(file, meminfo_proc_show, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct file_operations meminfo_proc_fops = {
|
|
|
|
.open = meminfo_proc_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init proc_meminfo_init(void)
|
|
|
|
{
|
|
|
|
proc_create("meminfo", 0, NULL, &meminfo_proc_fops);
|
|
|
|
return 0;
|
|
|
|
}
|
2014-01-24 03:55:45 +04:00
|
|
|
fs_initcall(proc_meminfo_init);
|