public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] mm: process_mrelease: expedite clean file folio reclaim and add auto-kill
@ 2026-04-21 23:02 Minchan Kim
  2026-04-21 23:02 ` [PATCH v1 1/3] mm: process_mrelease: expedite clean file folio reclaim via mmu_gather Minchan Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Minchan Kim @ 2026-04-21 23:02 UTC (permalink / raw)
  To: akpm
  Cc: hca, linux-s390, david, mhocko, brauner, linux-mm, linux-kernel,
	surenb, timmurray, Minchan Kim

From: Minchan Kim <minchan@google.com>

This is v1 of the patch series to expedite clean file folio reclamation in
process_mrelease() and introduce an auto-kill flag to close race windows.

Currently, process_mrelease() unmaps pages but file-backed pages stay in
the pagecache, relying on standard memory reclaim to eventually free them.
This delays memory recovery in memory pressure scenarios (e.g., Android's
LMKD), leading to redundant kills of background apps. Also, the requirement
for userspace to send SIGKILL prior to process_mrelease() introduces a
race window where the victim task clears its ->mm before the reaper can
act, failing the syscall with -ESRCH and delaying reclamation due to
arbitrary reference counts (e.g., reading /proc/<pid>/cmdline).

Summary of v1 changes since last RFC
(https://lore.kernel.org/linux-mm/20260413223948.556351-1-minchan@kernel.org/)
- Patch 1:
  - Unified free_pages_and_caches() in mm/swap.c to handle both CONFIG_SWAP
    and !CONFIG_SWAP
  - Clean up description - David
- Patch 2:
  - Used !folio_maybe_mapped_shared(folio) instead of folio_mapcount - David
- Patch 3:
  - Used mmget() instead of mmgrab() to ensure that memory reclamation is
    performed synchronously and deterministically by the reaper, avoiding
    delays caused by non-deterministic scheduling of the victim task.
  - Dropped the custom KILL_MRELEASE signal code and modifications to
    siginfo.h and signal.c. Instead, use standard kill_pid(..., 0).

Minchan Kim (3):
  mm: process_mrelease: expedite clean file folio reclaim via mmu_gather
  mm: process_mrelease: skip LRU movement for exclusive file folios
  mm: process_mrelease: introduce PROCESS_MRELEASE_REAP_KILL flag

 arch/s390/include/asm/tlb.h |  2 +-
 include/linux/swap.h        |  5 ++--
 include/uapi/linux/mman.h   |  4 +++
 mm/memory.c                 | 13 ++++++++-
 mm/mmu_gather.c             |  7 +++--
 mm/oom_kill.c               | 56 ++++++++++++++++++++++++++-----------
 mm/swap.c                   | 42 ++++++++++++++++++++++++++++
 mm/swap_state.c             | 26 -----------------
 8 files changed, 104 insertions(+), 51 deletions(-)

-- 
2.54.0.rc1.555.g9c883467ad-goog



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

end of thread, other threads:[~2026-04-22  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 23:02 [PATCH v1 0/3] mm: process_mrelease: expedite clean file folio reclaim and add auto-kill Minchan Kim
2026-04-21 23:02 ` [PATCH v1 1/3] mm: process_mrelease: expedite clean file folio reclaim via mmu_gather Minchan Kim
2026-04-21 23:02 ` [PATCH v1 2/3] mm: process_mrelease: skip LRU movement for exclusive file folios Minchan Kim
2026-04-22  7:22   ` Baolin Wang
2026-04-21 23:02 ` [PATCH v1 3/3] mm: process_mrelease: introduce PROCESS_MRELEASE_REAP_KILL flag Minchan Kim

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