v7
2026-10-27
memcg stock 迁移 · v7
page_counter 引入每 CPU stock,迁移 memcg 库存并保持 memsw 与 memory 计数约束。
原始补丁链接
子 Patch(5)
1/5
mm/memcontrol: flatten try_charge_memcg control flow
Refactor try_charge_memcg by flattening the nested memsw/memory page_counter operations to separate the logic between the two. When page_counter_try_charge is made stock-aware, this flattening makes
2/5
mm/page_counter: introduce per-CPU stock
Introduce a copy of the seven-slot per-CPU stock representation from memcg in the page_counter layer. struct page_counter_stock_pcp preserves everything from struct memcg_stock_pcp, but adds a new bac
3/5
mm/page_counter: make page_counter_try_charge() stock-aware
Make page_counter_try_charge() consume stock transparently to callers while preserving the same semantics as try_charge_memcg’s greedy charge attempt, refill, and !allow_spinning special case. page_c
4/5
mm/memcontrol: move memory stock to page counters
Transition memcg to use the page_counter_stock for the memory page_counter instead of relying on a memcg-wide stock. One aspect that remains non-transparent to memcg is the uncharge path. This is int
5/5
mm/memcontrol: add stock to the memsw page counter
Attach legacy memsw page counters to their own seven-slot per-CPU stock. Charge, refill, drain, and hotplug handling now operate on the memory and memsw banks independently. Factor the common drain s