public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mm/memcontrol: control demotion in memcg reclaim
@ 2026-03-17 23:06 Bing Jiao
  2026-03-17 23:07 ` [PATCH 1/3] mm/memcontrol: fix reclaim_options leak in try_charge_memcg() Bing Jiao
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Bing Jiao @ 2026-03-17 23:06 UTC (permalink / raw)
  To: linux-mm
  Cc: Bing Jiao, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Shakeel Butt, Muchun Song, Andrew Morton, David Rientjes,
	Yosry Ahmed, cgroups, linux-kernel, Chris Li, Kairui Song,
	Kemeng Shi, Nhat Pham, Baoquan He, Barry Song, Youngjun Park,
	David Hildenbrand, Qi Zheng, Lorenzo Stoakes, Axel Rasmussen,
	Yuanchu Xie, Wei Xu, Joshua Hahn

In tiered-memory systems, NUMA demotion counts towards reclaim targets
in shrink_folio_list(), but it does not reduce the total memory usage of
a memcg.

In memcg direct reclaim paths (charge-triggered or manual limit writes),
this leads to "fake progress" where the reclaim loop concludes it has
satisfied the memory request without actually reducing the cgroup's charge.
This results in inefficient reclaim loops, CPU waste, moving all pages
to far-tier nodes, and potentially premature OOM kills, and potentially
premature OOM kills when the cgroup is under memory pressure but demotion
is still possible.

This series fixes this issue by disabling demotion in memcg-specific
direct reclaim paths and provides user control for proactive reclaim.

Patch 1: Fixes a state leak in try_charge_memcg() where reclaim_options
were modified and carried over to retries improperly.

Patch 2: Introduces MEMCG_RECLAIM_NO_DEMOTION and disables demotion in
memcg direct reclaim paths.

Patch 3: Adds a 'demote=' option to the proactive reclaim interface
(memory.reclaim), allowing users to explicitly enable demotion if
desired, while defaulting it to disabled for consistency.

Bing Jiao (3):
  mm/memcontrol: fix reclaim_options leak in try_charge_memcg()
  mm/memcontrol: disable demotion in memcg direct reclaim
  mm/vmscan: add demote= option to proactive reclaim

 include/linux/swap.h |  1 +
 mm/memcontrol-v1.c   | 10 ++++++++--
 mm/memcontrol.c      | 17 ++++++++++++-----
 mm/vmscan.c          | 11 +++++++++++
 4 files changed, 32 insertions(+), 7 deletions(-)

--
2.53.0.851.ga537e3e6e9-goog


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

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

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 23:06 [PATCH 0/3] mm/memcontrol: control demotion in memcg reclaim Bing Jiao
2026-03-17 23:07 ` [PATCH 1/3] mm/memcontrol: fix reclaim_options leak in try_charge_memcg() Bing Jiao
2026-03-17 23:38   ` Yosry Ahmed
2026-03-17 23:07 ` [PATCH 2/3] mm/memcontrol: disable demotion in memcg direct reclaim Bing Jiao
2026-03-17 23:44   ` Yosry Ahmed
2026-03-18 20:57     ` Bing Jiao
2026-03-18 21:56       ` [PATCH v2] mm/memcontrol: fix reclaim_options leak in try_charge_memcg() Bing Jiao
2026-03-18 22:06         ` Yosry Ahmed
2026-03-18 22:19         ` [PATCH v3] " Bing Jiao
2026-03-18 22:54           ` Johannes Weiner
2026-03-18 23:28           ` Shakeel Butt
2026-03-19  9:29           ` Michal Hocko
2026-03-20  3:39             ` Bing Jiao
2026-03-20  9:32               ` Michal Hocko
2026-03-21  3:34           ` [PATCH v4] " Bing Jiao
2026-03-20 13:17   ` [PATCH 2/3] mm/memcontrol: disable demotion in memcg direct reclaim Donet Tom
2026-03-21  4:04     ` Bing Jiao
2026-03-17 23:07 ` [PATCH 3/3] mm/vmscan: add demote= option to proactive reclaim Bing Jiao

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