linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [DISCUSS] Proposal: move slab shrinking into a dedicated kernel thread to improve reclaim efficiency
@ 2025-10-21  2:52 Yifan Ji
  2025-10-21  5:25 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Yifan Ji @ 2025-10-21  2:52 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Michal Hocko, Johannes Weiner, Vlastimil Babka,
	Matthew Wilcox

Hi all,

We've been profiling memory reclaim performance on mobile systems and found
that slab shrinking can dominate reclaim time, particularly when multiple
shrinkers are active. In some cases, shrink_slab() introduces noticeable
latency in both direct reclaim and kswapd contexts.

We are exploring an approach to move slab shrinking into a dedicated kernel
thread, decoupling it from direct reclaim and kswapd. The goal is to perform
slab reclaim asynchronously under controlled conditions such as idle periods
or vmpressure triggers.

Motivation:
 - Reduce latency in direct reclaim paths.
 - Improve reclaim efficiency by separating page and slab reclaim.
 - Provide more flexible scheduling for slab shrinking.

Proposed direction:
 - Introduce a kernel thread that periodically or conditionally calls
shrink_slab().

We'd appreciate feedback on:
 - Whether this decoupling aligns with the design of the current reclaim model.
 - Possible implications on fairness, concurrency, and memcg behavior.

Thanks for your time and input.

Best regards,
Yifan Ji


^ permalink raw reply	[flat|nested] 4+ messages in thread
* [DISCUSS] Proposal: move slab shrinking into a dedicated kernel thread to improve reclaim efficiency
@ 2025-10-20  2:22 Yifan Ji
  0 siblings, 0 replies; 4+ messages in thread
From: Yifan Ji @ 2025-10-20  2:22 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Andrew Morton, Michal Hocko, Johannes Weiner,
	Vlastimil Babka, Matthew Wilcox

[-- Attachment #1: Type: text/plain, Size: 1901 bytes --]

Hi all,

We have been investigating reclaim performance on mobile systems under
memory pressure and noticed that slab shrinking often accounts for a
significant portion of reclaim time in both direct reclaim and kswapd
contexts.
In some cases, shrink_slab() can take noticeably long when multiple
shrinkers are active, leading to latency spikes and slower overall reclaim
progress.

To address this, we are considering an approach to move slab shrinking
into a *dedicated kernel thread*. The intention is to decouple slab reclaim
from the direct reclaim and kswapd paths, allowing it to proceed
asynchronously under controlled conditions such as system idle periods or
specific reclaim triggers.

*Motivation:*

   -

   Reduce latency in direct reclaim paths by offloading potentially
   long-running slab reclaim work.
   -

   Improve overall reclaim efficiency by scheduling slab shrinking
   separately from page reclaim.
   -

   Allow more flexible control over when and how slab caches are aged
   or shrunk.

*Proposed direction:*

   -

   Introduce a kernel thread responsible for invoking
   shrink_slab() periodically or when signaled.
   -

   Keep the existing shrinker infrastructure intact but move the
   execution context outside of direct reclaim and kswapd.
   -

   Optionally trigger this thread based on system activity (e.g.
   idle detection, vmpressure events, or background reclaim).

We’d like to gather community feedback on:

   -

   Whether decoupling slab reclaim from kswapd and direct reclaim
   makes sense from a design and maintainability perspective.
   -

   Potential implications on fairness, concurrency, and memcg
   accounting.
   -

   Any related prior work or alternative ideas that have been discussed
   in this area.

Thanks for your time and consideration.

Best regards,
Yifan Ji

[-- Attachment #2: Type: text/html, Size: 2169 bytes --]

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

end of thread, other threads:[~2025-10-24  0:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  2:52 [DISCUSS] Proposal: move slab shrinking into a dedicated kernel thread to improve reclaim efficiency Yifan Ji
2025-10-21  5:25 ` Christoph Hellwig
2025-10-24  0:47   ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2025-10-20  2:22 Yifan Ji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).