[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250902031359.170361-1-sj@kernel.org>
Date: Mon, 1 Sep 2025 20:13:59 -0700
From: SeongJae Park <sj@...nel.org>
To: SeongJae Park <sj@...nel.org>
Cc: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
Brendan Jackman <jackmanb@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Zi Yan <ziy@...dia.com>,
kernel-dev@...lia.com
Subject: Re: [PATCH] mm: show_mem: show number of zspages in show_free_areas
On Mon, 1 Sep 2025 18:49:33 -0700 SeongJae Park <sj@...nel.org> wrote:
> Hello,
>
> On Mon, 1 Sep 2025 15:37:28 -0300 Thadeu Lima de Souza Cascardo <cascardo@...lia.com> wrote:
>
> > When OOM is triggered, it will show where the pages might be for each zone.
> > When using zram, it might look like lots of pages are missing. After this
> > patch, zspages are shown as below.
> [...]
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>
> > ---
> > mm/show_mem.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/mm/show_mem.c b/mm/show_mem.c
> > index 41999e94a56d..ecf20a93ea54 100644
> > --- a/mm/show_mem.c
> > +++ b/mm/show_mem.c
> > @@ -310,6 +310,7 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
> > " inactive_file:%lukB"
> > " unevictable:%lukB"
> > " writepending:%lukB"
> > + " zspages:%lukB"
> > " present:%lukB"
> > " managed:%lukB"
> > " mlocked:%lukB"
> > @@ -332,6 +333,7 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
> > K(zone_page_state(zone, NR_ZONE_INACTIVE_FILE)),
> > K(zone_page_state(zone, NR_ZONE_UNEVICTABLE)),
> > K(zone_page_state(zone, NR_ZONE_WRITE_PENDING)),
> > + K(zone_page_state(zone, NR_ZSPAGES)),
>
> I found latest mm-new fails kunit's um build as below, and 'git bisect' points
> this patch.
>
> $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=40
> ERROR:root:In file included from ../mm/show_mem.c:18:
> ../mm/show_mem.c: In function ‘show_free_areas’:
> ../mm/show_mem.c:336:49: error: ‘NR_ZSPAGES’ undeclared (first use in this function); did you mean ‘NR_STATS’?
> 336 | K(zone_page_state(zone, NR_ZSPAGES)),
> | ^~~~~~~~~~
> [...]
>
> Maybe some CONFIG_ZSMALLOC undeclard case handling, like below, is needed?
>
> --- a/mm/show_mem.c
> +++ b/mm/show_mem.c
> @@ -333,7 +333,9 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
> K(zone_page_state(zone, NR_ZONE_INACTIVE_FILE)),
> K(zone_page_state(zone, NR_ZONE_UNEVICTABLE)),
> K(zone_page_state(zone, NR_ZONE_WRITE_PENDING)),
> +#if IS_ENABLED(CONFIG_ZSMALLOC)
> K(zone_page_state(zone, NR_ZSPAGES)),
> +#endif
Of course, the above example will make the output shows wrong values on
'zspages:' and later fields when ZSMALLOC is unset. Maybe below change on top
of the above diff makes sense?
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -335,6 +335,8 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
K(zone_page_state(zone, NR_ZONE_WRITE_PENDING)),
#if IS_ENABLED(CONFIG_ZSMALLOC)
K(zone_page_state(zone, NR_ZSPAGES)),
+#else
+ 0,
#endif
K(zone->present_pages),
K(zone_managed_pages(zone)),
Thanks,
SJ
[...]
Powered by blists - more mailing lists