v2
2026-10-31
重构memcg高限回收 · v2
重构 memcg memory.high 执行:从 try_charge_memcg() 移出,回收前强制计费,内核线程和远程计费改用 high_work。
原始补丁链接
子 Patch(5)
1/5
memcg: move memory.high enforcement out of try_charge_memcg()
On Oct 31, 2026, at 04:54, Shakeel Butt shakeel.butt@linux.dev wrote: > > try_charge_memcg() does a lot. It charges the page counters, reclaims > when a limit is hit, may call the OOM killer, and
2/5
memcg: force charges from reclaim before trying the limits
On Oct 31, 2026, at 04:54, Shakeel Butt shakeel.butt@linux.dev wrote: > > Reclaim can charge memory, for example when zswap stores a page. > try_charge_memcg() forces these PF_MEMALLOC charges, b
3/5
memcg: use high_work for kernel threads
On Oct 31, 2026, at 04:54, Shakeel Butt shakeel.butt@linux.dev wrote: > > Kernel threads never return to userspace, so deferred memory.high > reclaim does not run. Reclaim and throttling during a
4/5
memcg: use high_work for remote charges
On Oct 31, 2026, at 04:54, Shakeel Butt shakeel.butt@linux.dev wrote: > > Some charges go to a cgroup outside the current mm’s cgroup and its > ancestors. The high handler uses current->mm, so it
5/5
memcg: simplify high limit handling after a charge
拆分 memcg 层级扫描与 high limit 执行:先找首个超限 cgroup,再排队 high_work 或记录 task overage;worker 只查 memory.high,本地 charge 兼查 swap.high,并独立检查 pending overage,以防阻塞 charge 漏处理旧超额。