Re: [RFC PATCH 0/5] mm/mglru: walk page tables under per-VMA locks
From: Barry Song
Date: Fri Dec 04 2026 - 05:44:01 EST
On Fri, Dec 4, 2026 at 6:39 PM Zicheng Wang <wangzicheng@xxxxxxxxx> wrote:
>
> Hi Suren, Chuanhua, Lorenzo,
>
> We hit the same stalls (140-250ms mmap/munmap/mprotect waits on
> SurfaceFlinger and Launcher) and have a measurement that may be
> relevant to the try_lock_next_vma() direction.
>
> In 3 dogfood user traces we picked for this problem, each with janky
> frames over 500ms, a direct reclaim task doing the aging walk holds
> mmap_lock for 140-250ms. Over 99% of that hold is spent runnable,
> waiting to be scheduled; the aging walk itself runs for less than 1ms.
> Each trace has thousands of direct reclaim events inside the jank window.
>
> A finer lock narrows who waits, but not how long. The walker runs with
> preemption enabled while holding the lock, so a round can be preempted
> mid-way and the lock is then held for the whole scheduling delay.
>
> Since the aging walk itself is already fast (<1ms), could we simply
> disable preemption during the walk's lock-hold window instead of
> changing the lock? We are testing a ~60-line prototype (no new lock or API)
> and will send the patch and data separately—mainly wondering whether
> you would prefer bounding that non-preemptible window at PUD or PMD
> granularity.
Hi Zicheng,
Disabling preemption for 1 ms is unlikely to fly upstream, as
that's simply too long. Now imagine 200 threads doing direct
reclaim, each in a different memcg. That could result in a
cumulative preemption-disabled time of 200 ms.
Thanks,
Barry