Re: [PATCH RFC v1 2/2] mm, pcp: add more detail info about high order page count

From: Mel Gorman
Date: Tue Jan 16 2024 - 09:40:15 EST


On Mon, Jan 15, 2024 at 05:34:36PM +0800, Vern Hao wrote:
> From: Xin Hao <vernhao@xxxxxxxxxxx>
>
> With this patch, we can see the distribution of pages of different orders on
> each cpu, just like below.
> #cat /proc/zoneinfo
> ....
> cpu: 2
> total_count: 14286
> order0 : 1260
> order1 : 13
> order2 : 42
> order3 : 4
> order4 : 0
> order5 : 0
> order6 : 0
> order7 : 0
> order8 : 0
> order9 : 25
> order10: 0
> order11: 0
> order12: 0
> high: 14541
> batch: 63
>
> Signed-off-by: Xin Hao <vernhao@xxxxxxxxxxx>

I am not a major fan because increasing the size of a per-cpu structure for
debugging purposes incurs a cost for everyone while only a tiny minority
may care. There is a mild risk it would break existing parsers of that file
although maybe that's not a big deal. However, the same information could be
extracted by locking the pcp structures and counting the items per list. It
would increase the cost of reading zoneinfo but it's unlikely the file is
read at high frequency. If that was a concern, a separate proc file could be
used. Finally, the same information likely can be extracted via a systemtap
script, a BPF script (if it can get to the right symbols and locking, I
didn't check) or via a kernel probe. Even with that information, it's not
clear what meaningful action a user can take, so this is a developer-only
feature really with a cost incurred for everybody.

--
Mel Gorman
SUSE Labs