]> Git Repo - linux.git/commit
mm: memcontrol: optimize per-lruvec stats counter memory usage
authorMuchun Song <[email protected]>
Wed, 24 Feb 2021 20:03:15 +0000 (12:03 -0800)
committerLinus Torvalds <[email protected]>
Wed, 24 Feb 2021 21:38:29 +0000 (13:38 -0800)
commitf3344adf38bdb3107d40483dd9501215ad40edce
treeafd77361c5a91919d9c953a3d6fc906b7da6ee54
parent2e9bd483159939ed2c0704b914294653c8341d25
mm: memcontrol: optimize per-lruvec stats counter memory usage

The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), Actually the threshold
can be as big as MEMCG_CHARGE_BATCH * PAGE_SIZE.  It still fits into s32.
So introduce struct batched_lruvec_stat to optimize memory usage.

The size of struct lruvec_stat is 304 bytes on 64 bit systems.  As it is a
per-cpu structure.  So with this patch, we can save 304 / 2 * ncpu bytes
per-memcg per-node where ncpu is the number of the possible CPU.  If there
are c memory cgroup (include dying cgroup) and n NUMA node in the system.
Finally, we can save (152 * ncpu * c * n) bytes.

[[email protected]: fix typo in comment]

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Muchun Song <[email protected]>
Reviewed-by: Shakeel Butt <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Cc: Chris Down <[email protected]>
Cc: Yafang Shao <[email protected]>
Cc: Wei Yang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/memcontrol.h
mm/memcontrol.c
This page took 0.059737 seconds and 4 git commands to generate.