Re: [PATCH v2] mm: vmscan: apply proportional reclaim pressure for memcg when MGLRU is enabled
From: Yuanchu Xie
Date: Mon Jun 09 2025 - 17:02:50 EST
On Fri, May 30, 2025 at 9:24 AM Koichiro Den <den@xxxxxxxxxxxxx> wrote:
>
> From: Koichiro Den <koichiro.den@xxxxxxxxxxxxx>
>
> The scan implementation for MGLRU was missing proportional reclaim
> pressure for memcg, which contradicts the description in
> Documentation/admin-guide/cgroup-v2.rst (memory.{low,min} section).
>
> This issue can be observed in kselftest cgroup:test_memcontrol
> (specifically test_memcg_min and test_memcg_low). The following table
> shows the actual values observed in my local test env (on xfs) and the
> error "e", which is the symmetric absolute percentage error from the ideal
> values of 29M for c[0] and 21M for c[1].
>
> test_memcg_min
>
> | MGLRU enabled | MGLRU enabled | MGLRU disabled
> | Without patch | With patch |
> -----|-----------------|-----------------|---------------
> c[0] | 25964544 (e=8%) | 28770304 (e=3%) | 27820032 (e=4%)
> c[1] | 26214400 (e=9%) | 23998464 (e=4%) | 24776704 (e=6%)
>
> test_memcg_low
>
> | MGLRU enabled | MGLRU enabled | MGLRU disabled
> | Without patch | With patch |
> -----|-----------------|-----------------|---------------
> c[0] | 26214400 (e=7%) | 27930624 (e=4%) | 27688960 (e=5%)
> c[1] | 26214400 (e=9%) | 24764416 (e=6%) | 24920064 (e=6%)
>
> Factor out the proportioning logic to a new function and have MGLRU
> reuse it. While at it, update the eviction behavior via debugfs
> 'lru_gen' interface ('-' command with an explicit 'nr_to_reclaim'
> parameter) to ensure eviction is limited to the specified number.
>
> Signed-off-by: Koichiro Den <koichiro.den@xxxxxxxxxxxxx>
> ---
> Changes in v2:
> - Leverage the new evict_folios() parameter to ensure correct eviction
> limitation via debugfs
> - Update the commit message to use the latest upstream kselftest instead
> of LTP memcontrol03.
>
> v1: https://lore.kernel.org/all/20250404141118.3895592-1-koichiro.den@xxxxxxxxxxxxx/
> ---
Thanks for the update. It seems like Andrew already pulled the patch
into mm-new.
Reviewed-by: Yuanchu Xie <yuanchu@xxxxxxxxxx>