linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/show_mem: Print totalreserve_pages in show_mem output
@ 2025-08-14  9:26 Ye Liu
  2025-08-14 14:15 ` Johannes Weiner
  0 siblings, 1 reply; 2+ messages in thread
From: Ye Liu @ 2025-08-14  9:26 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka
  Cc: Ye Liu, Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, linux-mm, linux-kernel

From: Ye Liu <liuye@kylinos.cn>

Add totalreserve_pages to the main show_mem output line for easier
debugging and memory analysis. This helps developers and
administrators quickly see how many pages are reserved by the kernel
and not available for user allocations.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/show_mem.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/show_mem.c b/mm/show_mem.c
index 41999e94a56d..c56d5599de45 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -201,7 +201,8 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
 		" mapped:%lu shmem:%lu pagetables:%lu\n"
 		" sec_pagetables:%lu bounce:%lu\n"
 		" kernel_misc_reclaimable:%lu\n"
-		" free:%lu free_pcp:%lu free_cma:%lu\n",
+		" free:%lu free_pcp:%lu free_cma:%lu\n"
+		" totalreserve_pages:%lu\n",
 		global_node_page_state(NR_ACTIVE_ANON),
 		global_node_page_state(NR_INACTIVE_ANON),
 		global_node_page_state(NR_ISOLATED_ANON),
@@ -221,7 +222,8 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
 		global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE),
 		global_zone_page_state(NR_FREE_PAGES),
 		free_pcp,
-		global_zone_page_state(NR_FREE_CMA_PAGES));
+		global_zone_page_state(NR_FREE_CMA_PAGES),
+		totalreserve_pages);
 
 	for_each_online_pgdat(pgdat) {
 		if (show_mem_node_skip(filter, pgdat->node_id, nodemask))
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/show_mem: Print totalreserve_pages in show_mem output
  2025-08-14  9:26 [PATCH] mm/show_mem: Print totalreserve_pages in show_mem output Ye Liu
@ 2025-08-14 14:15 ` Johannes Weiner
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2025-08-14 14:15 UTC (permalink / raw)
  To: Ye Liu
  Cc: Andrew Morton, Vlastimil Babka, Ye Liu, Suren Baghdasaryan,
	Michal Hocko, Brendan Jackman, Zi Yan, linux-mm, linux-kernel

On Thu, Aug 14, 2025 at 05:26:21PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> Add totalreserve_pages to the main show_mem output line for easier
> debugging and memory analysis. This helps developers and
> administrators quickly see how many pages are reserved by the kernel
> and not available for user allocations.

This number isn't used very widely in decision making.

For actual allocations, what matters is watermarks, lowmem_reserve,
highatomic, and cma pages - all of which are already printed out on a
per-zone basis in show_mem().


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-14 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  9:26 [PATCH] mm/show_mem: Print totalreserve_pages in show_mem output Ye Liu
2025-08-14 14:15 ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).