diff options
author | David Rientjes <rientjes@google.com> | 2013-04-29 18:07:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:35 -0400 |
commit | 949f7ec5760b021da3cccc1eaeb0671270e4238f (patch) | |
tree | 8610da7dff952d64cc59e8a922aa16fb430dd66e /mm/hugetlb.c | |
parent | 1444f92c84984dd13f3e8e121115783ae5b22c55 (diff) |
mm, hugetlb: include hugepages in meminfo
Particularly in oom conditions, it's troublesome that hugetlb memory is
not displayed. All other meminfo that is emitted will not add up to
what is expected, and there is no artifact left in the kernel log to
show that a potentially significant amount of memory is actually
allocated as hugepages which are not available to be reclaimed.
Booting with hugepages=8192 on the command line, this memory is now
shown in oom conditions. For example, with echo m >
/proc/sysrq-trigger:
Node 0 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 1 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 2 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 3 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 73b864a32017..9b9aeef8e590 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2121,6 +2121,21 @@ int hugetlb_report_node_meminfo(int nid, char *buf) | |||
2121 | nid, h->surplus_huge_pages_node[nid]); | 2121 | nid, h->surplus_huge_pages_node[nid]); |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | void hugetlb_show_meminfo(void) | ||
2125 | { | ||
2126 | struct hstate *h; | ||
2127 | int nid; | ||
2128 | |||
2129 | for_each_node_state(nid, N_MEMORY) | ||
2130 | for_each_hstate(h) | ||
2131 | pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n", | ||
2132 | nid, | ||
2133 | h->nr_huge_pages_node[nid], | ||
2134 | h->free_huge_pages_node[nid], | ||
2135 | h->surplus_huge_pages_node[nid], | ||
2136 | 1UL << (huge_page_order(h) + PAGE_SHIFT - 10)); | ||
2137 | } | ||
2138 | |||
2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ | 2139 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
2125 | unsigned long hugetlb_total_pages(void) | 2140 | unsigned long hugetlb_total_pages(void) |
2126 | { | 2141 | { |