mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH for-7.5 0/5] memcg: clean up memory.high enforcement
@ 2026-10-10 21:09 Shakeel Butt
  2026-10-10 21:09 ` [PATCH for-7.5 1/5] memcg: move memory.high enforcement out of try_charge_memcg() Shakeel Butt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Shakeel Butt @ 2026-10-10 21:09 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	Tejun Heo, Meta kernel team, cgroups, linux-mm, linux-kernel

This series cleans up memory.high enforcement and uses a worker for
kernel threads and remote charges.

Kernel threads never return to userspace to run deferred reclaim.
Reclaiming and sleeping during a charge can also delay work they do for
other tasks.

Remote charges can go to a different cgroup from the caller's mm, for
example through filesystem notifications or faults in another process's
memory. The high handler uses current->mm, so it can check the caller's
limits instead of the limits of the charged cgroup.

Use high_work to reclaim from the charged hierarchy in these cases.
mm_match_cgroup() identifies charges outside the current mm's cgroup
and its ancestors. Local user charges keep their current handling.

Skip queuing work from PF_MEMALLOC tasks. Reclaim can charge memory
itself, for example when zswap stores a page, and high_work must not
keep queuing itself from its own reclaim.

This is best effort. A fast allocator can keep usage well above
memory.high. The worker paths also skip memory.swap.high throttling
and its high-event reporting. The memory.max and memory.swap.max checks
stay the same.

The first patch moves enforcement into memcg_enforce_high(). The next
two add kernel thread and remote charge handling. The fourth adds the
reclaim guard. The last simplifies the scan and comments. The first
and last patches have no intended behavior change.

Based on next-20261009. Tested in an x86-64 VM with loop writes, threaded
NAPI, remote faults, notifications, and both vhost worker modes. The
remote tests kept same-cgroup and ancestor charges on the local path.
An incompressible zswap test queued high_work from its own reclaim 163
times without the guard.

Shakeel Butt (5):
  memcg: move memory.high enforcement out of try_charge_memcg()
  memcg: use high_work for kernel threads
  memcg: use high_work for remote charges
  memcg: avoid queuing high_work from reclaim
  memcg: simplify high limit handling after a charge

 mm/memcontrol.c | 136 +++++++++++++++++++++++++++---------------------
 1 file changed, 77 insertions(+), 59 deletions(-)


base-commit: becb95e45ef0dda9ffb35156d909d3da7a2789c3
-- 
2.53.0-Meta

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-10 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 21:09 [PATCH for-7.5 0/5] memcg: clean up memory.high enforcement Shakeel Butt
2026-10-10 21:09 ` [PATCH for-7.5 1/5] memcg: move memory.high enforcement out of try_charge_memcg() Shakeel Butt
2026-10-10 21:09 ` [PATCH for-7.5 2/5] memcg: use high_work for kernel threads Shakeel Butt
2026-10-10 21:09 ` [PATCH for-7.5 3/5] memcg: use high_work for remote charges Shakeel Butt
2026-10-10 21:09 ` [PATCH for-7.5 4/5] memcg: avoid queuing high_work from reclaim Shakeel Butt
2026-10-10 21:09 ` [PATCH for-7.5 5/5] memcg: simplify high limit handling after a charge Shakeel Butt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®