v1 2026-08-20

引入按内存层级 memcg 记账与控制 · v1

RFC提出per(memcg,tier)的per-tier计数与限制;维护者回应勿与Joshua Hahn方案重复,建议协作。

原始补丁链接

子 Patch(8)

1/8
mm/memory-tiers: add node_to_tier_id and tier_id_to_nodemask
新增node_to_tier_id()和tier_id_to_nodemask()辅助函数,分别用于无锁和可睡眠场景下NUMA节点与memory tier互转,供per-tier memcg使用。
2/8
mm/vmscan: add try_to_free_mem_cgroup_pages_nodemask
From: Qiqi Liu liuqiqi@kylinos.cn try_to_free_mem_cgroup_pages() reclaims from all nodes of a cgroup. Refactor it to call a new helper, try_to_free_mem_cgroup_pages_nodemask(), which constrains sca
3/8
mm/memcontrol: add per-tier page counter infrastructure and lifecycle
引入struct memcg_tier_counter按(memcg,tier)管理层级page_counter,在css_alloc时预分配在线节点计数器,RCU查找,css_free销毁,尚未接入charge路径。
4/8
mm/memcontrol: add per-tier charge and uncharge
From: Qiqi Liu liuqiqi@kylinos.cn Extend the memcg charging infrastructure to support per-tier accounting. After a successful global charge (try_charge_memcg), charge_memcg() attempts per-tier char
5/8
mm/memcontrol: add per-cpu stock for tier charge/uncharge
From: Qiqi Liu liuqiqi@kylinos.cn Add tier_stock_pcp, a per-cpu cache with NR_TIER_STOCK slots, to cache charge surplus for specific (memcg, tier_id) pairs. The fast path, consume_tier_stock(), at
6/8
mm/memcontrol: add memory.tier control file
From: Qiqi Liu liuqiqi@kylinos.cn Introduce the memory.tier control file to expose per-tier usage and limits. Counters are pre-allocated during css_alloc or memory hotplug: tierN.current=
7/8
mm/memcontrol: auto-derive tier high/max from memory.high/max
From: Qiqi Liu liuqiqi@kylinos.cn Per-tier limits are derived by default from the cgroup-wide memory.high and memory.max knobs based on the tier’s capacity ratio: tierN.high = memory.high * tier
8/8
cgroup: add memory_tiered_limits cgroup mount option
From: Qiqi Liu liuqiqi@kylinos.cn Introduce the memory_tiered_limits cgroup v2 mount option to enable tier-aware memory control. The option follows the same pattern as memory_recursiveprot and memo