mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
meminfo: add a per node counter for balloon drivers
Patch series "track memory used by balloon drivers", v2. This series introduces a way to track memory used by balloon drivers. Add a NR_BALLOON_PAGES counter to track how many pages are reclaimed by the balloon drivers. First add the accounting, then updates the balloon drivers (virtio, Hyper-V, VMware, Pseries-cmm, and Xen) to maintain this counter. The virtio, Vmware, and pseries-cmm balloon drivers utilize the balloon_compaction interface to allocate and free balloon pages. Other balloon drivers will have to maintain this counter manually. This makes the information visible in memory reporting interfaces like /proc/meminfo, show_mem, and OOM reporting. This provides admins visibility into their VM balloon sizes without requiring different virtualization tooling. Furthermore, this information is helpful when debugging an OOM inside a VM. This patch (of 4): Add NR_BALLOON_PAGES counter to track memory used by balloon drivers and expose it through /proc/meminfo and other memory reporting interfaces. [[email protected]: document Balloon Meminfo entry] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Nico Pache <[email protected]> Cc: Alexander Atanasov <[email protected]> Cc: Chengming Zhou <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Juegren Gross <[email protected]> Cc: Kanchana P Sridhar <[email protected]> Cc: K. Y. Srinivasan <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Muchun Song <[email protected]> Cc: Nhat Pham <[email protected]> Cc: Oleksandr Tyshchenko <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Wei Liu <[email protected]> Cc: Michael Kelley <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
0d2a260523
commit
835de37603
5 files changed
+10
-1
No files matched your search
@@ -1081,6 +1081,7 @@ Example output. You may not have all of these fields.
|
||||
FilePmdMapped: 0 kB
|
||||
CmaTotal: 0 kB
|
||||
CmaFree: 0 kB
|
||||
Balloon: 0 kB
|
||||
HugePages_Total: 0
|
||||
HugePages_Free: 0
|
||||
HugePages_Rsvd: 0
|
||||
@@ -1255,6 +1256,8 @@ CmaTotal
|
||||
Memory reserved for the Contiguous Memory Allocator (CMA)
|
||||
CmaFree
|
||||
Free remaining memory in the CMA reserves
|
||||
Balloon
|
||||
Memory returned to Host by VM Balloon Drivers
|
||||
HugePages_Total, HugePages_Free, HugePages_Rsvd, HugePages_Surp, Hugepagesize, Hugetlb
|
||||
See Documentation/admin-guide/mm/hugetlbpage.rst.
|
||||
DirectMap4k, DirectMap2M, DirectMap1G
|
||||
|
||||
@@ -162,6 +162,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
|
||||
show_val_kb(m, "Unaccepted: ",
|
||||
global_zone_page_state(NR_UNACCEPTED));
|
||||
#endif
|
||||
show_val_kb(m, "Balloon: ",
|
||||
global_node_page_state(NR_BALLOON_PAGES));
|
||||
|
||||
hugetlb_report_meminfo(m);
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ enum node_stat_item {
|
||||
#ifdef CONFIG_HUGETLB_PAGE
|
||||
NR_HUGETLB,
|
||||
#endif
|
||||
NR_BALLOON_PAGES,
|
||||
NR_VM_NODE_STAT_ITEMS
|
||||
};
|
||||
|
||||
|
||||
+3
-1
@@ -260,6 +260,7 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
|
||||
" pagetables:%lukB"
|
||||
" sec_pagetables:%lukB"
|
||||
" all_unreclaimable? %s"
|
||||
" Balloon:%lukB"
|
||||
"\n",
|
||||
pgdat->node_id,
|
||||
K(node_page_state(pgdat, NR_ACTIVE_ANON)),
|
||||
@@ -285,7 +286,8 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
|
||||
#endif
|
||||
K(node_page_state(pgdat, NR_PAGETABLE)),
|
||||
K(node_page_state(pgdat, NR_SECONDARY_PAGETABLE)),
|
||||
str_yes_no(pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES));
|
||||
str_yes_no(pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES),
|
||||
K(node_page_state(pgdat, NR_BALLOON_PAGES)));
|
||||
}
|
||||
|
||||
for_each_populated_zone(zone) {
|
||||
|
||||
@@ -1277,6 +1277,7 @@ const char * const vmstat_text[] = {
|
||||
#ifdef CONFIG_HUGETLB_PAGE
|
||||
"nr_hugetlb",
|
||||
#endif
|
||||
"nr_balloon_pages",
|
||||
/* system-wide enum vm_stat_item counters */
|
||||
"nr_dirty_threshold",
|
||||
"nr_dirty_background_threshold",
|
||||
|
||||
Reference in new issue
Block a user