Re: [PATCH v2 1/4] memcg: store node_id instead of pglist_data pointer
From: Qi Zheng
Date: Thu May 21 2026 - 22:31:03 EST
On 5/22/26 9:19 AM, Shakeel Butt wrote:
The struct obj_stock_pcp stores a pointer to pglist_data for the slab
stats cached on the cpu. On 64-bit machines, this costs 8 bytes. The
pointer is not strictly required: NODE_DATA() can recover it from the
node id. Replace cached_pgdat with int16_t node_id and use NUMA_NO_NODE
as the "no stats cached" sentinel.
At the moment all the archs limit MAX_NUMNODES to 1024 so int16_t is
plenty; a BUILD_BUG_ON() makes sure we notice if that ever changes.
Fixes: 01b9da291c49 ("mm: memcontrol: convert objcg to be per-memcg per-node type")
Tested-by: kernel test robot <oliver.sang@xxxxxxxxx>
Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
Reviewed-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
---
Changes since v1:
- Added tags in the commit message
mm/memcontrol.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
Acked-by: Qi Zheng <qi.zheng@xxxxxxxxx>
Thanks!