Re: [PATCH v6 00/14] mm/mglru: improve reclaim loop and dirty folio handling
From: Kairui Song
Date: Fri Apr 24 2026 - 08:56:43 EST
On Fri, Apr 24, 2026 at 7:58 PM Barry Song <baohua@xxxxxxxxxx> wrote:
> Could this be because get_nr_to_scan() was moved out of the loop by
> [PATCH v6 04/14] mm/mglru: restructure the reclaim loop,
> while in mainline it is re-evaluated in each iteration?
>
> Will take a look tomorrow or the day after.
>
> Thanks
> Barry
>
Hi Barry,
I ran your test script a few times, and strangely I can't reproduce
it. Swapniess behaves similarly after or before this series. I
directly checked out the mm-new commit of this series (4ce85c040e0a)
and compare to the mm-new commit right before this series
(31a112f05f62). I also extended your script a bit to test more
swappiness:
Before:
uname -a
Linux localhost 7.0.0.mm-new-g31a112f05f62 #305 SMP PREEMPT_DYNAMIC
Fri Apr 24 19:07:30 CST 2026 x86_64 GNU/Linux
*** Executing swappiness 5 ***
set swappiness to 5
Running as unit: run-p6675-i151640.scope; invocation ID:
e8b79eab2854418b81c2ad62c3d121c4
real 1m50.652s
user 38m58.129s
sys 21m41.763s
pswpin: 15917615
pswpout: 41199479
pgpgin: 76113864
pgpgout: 165640720
swpout_zero: 1546131
swpin_zero: 285359
refault_file: 1648508
refault_anon: 15829347
*** Executing swappiness 35 ***
set swappiness to 35
Running as unit: run-p44771-i189005.scope; invocation ID:
562deebdc09647a290a2165870295ef7
real 1m50.623s
user 38m50.505s
sys 21m45.217s
pswpin: 15915841
pswpout: 41297235
pgpgin: 75425648
pgpgout: 166025592
swpout_zero: 1546865
swpin_zero: 277756
refault_file: 1546926
refault_anon: 15778795
*** Executing swappiness 70 ***
set swappiness to 70
Running as unit: run-p82859-i1819.scope; invocation ID:
82aead8ff78742bba6bf401a6534588e
real 1m49.605s
user 38m30.262s
sys 21m49.417s
pswpin: 16088273
pswpout: 41592875
pgpgin: 71469324
pgpgout: 167370708
swpout_zero: 1657002
swpin_zero: 319600
refault_file: 857694
refault_anon: 16175619
*** Executing swappiness 105 ***
set swappiness to 105
Running as unit: run-p120948-i250916.scope; invocation ID:
e7bc4e739cab4e8bbc5efb06b50ead14
real 1m48.951s
user 38m30.080s
sys 21m48.815s
pswpin: 16265236
pswpout: 41884071
pgpgin: 70923620
pgpgout: 168654260
swpout_zero: 1649763
swpin_zero: 316386
refault_file: 691818
refault_anon: 16368960
*** Executing swappiness 140 ***
set swappiness to 140
Running as unit: run-p159035-i42797.scope; invocation ID:
ea31084e41bf4c7b9427800bf78500fb
real 1m49.596s
user 38m32.881s
sys 21m50.914s
pswpin: 16434435
pswpout: 42315789
pgpgin: 70803660
pgpgout: 170344784
swpout_zero: 1659821
swpin_zero: 314116
refault_file: 563047
refault_anon: 16557648
*** Executing swappiness 175 ***
set swappiness to 175
Running as unit: run-p197122-i325303.scope; invocation ID:
181af70e74b74bff901e10ed97d32c50
real 1m49.091s
user 38m31.101s
sys 21m56.002s
pswpin: 16470200
pswpout: 42370706
pgpgin: 70388644
pgpgout: 170452728
swpout_zero: 1689922
swpin_zero: 330216
refault_file: 487950
refault_anon: 16613124
*** Executing swappiness 200 ***
set swappiness to 200
Running as unit: run-p235206-i68603.scope; invocation ID:
d6af085ecd9a47a88ddecfb326af4d58
real 1m49.458s
user 38m37.696s
sys 22m7.194s
pswpin: 16473742
pswpout: 42413098
pgpgin: 70351964
pgpgout: 170454504
swpout_zero: 1653981
swpin_zero: 316654
refault_file: 539774
refault_anon: 16620315
After:
uname -a
Linux localhost 7.0.0.ptch-g4ce85c040e0a #2733 SMP PREEMPT_DYNAMIC Fri
Apr 24 19:07:08 CST 2026 x86_64 GNU/Linux
*** Executing swappiness 5 ***
set swappiness to 5
Running as unit: run-p10510-i123098.scope; invocation ID:
7773cea9690140378786e496d7bf0523
real 1m50.042s
user 38m59.555s
sys 21m25.018s
pswpin: 15913149
pswpout: 41183479
pgpgin: 76136184
pgpgout: 165910472
swpout_zero: 1557330
swpin_zero: 282842
refault_file: 1599524
refault_anon: 15876245
*** Executing swappiness 35 ***
set swappiness to 35
Running as unit: run-p48606-i45593.scope; invocation ID:
66799f770f0944558b258fa42a62cd28
real 1m50.479s
user 38m59.363s
sys 21m27.155s
pswpin: 15865488
pswpout: 41087641
pgpgin: 75103236
pgpgout: 165212060
swpout_zero: 1557445
swpin_zero: 287809
refault_file: 1421868
refault_anon: 15790633
*** Executing swappiness 70 ***
set swappiness to 70
Running as unit: run-p86689-i246403.scope; invocation ID:
ac7303701c524901a64c9a5b945f9e20
real 1m49.409s
user 38m36.037s
sys 21m37.421s
pswpin: 16198083
pswpout: 41876332
pgpgin: 71719832
pgpgout: 168490208
swpout_zero: 1622494
swpin_zero: 304799
refault_file: 847114
refault_anon: 16283181
*** Executing swappiness 105 ***
set swappiness to 105
Running as unit: run-p124782-i205752.scope; invocation ID:
591727ffbc1d40c1b79a5a20567e1616
real 1m48.638s
user 38m28.237s
sys 21m31.590s
pswpin: 16278124
pswpout: 41920058
pgpgin: 70591876
pgpgout: 168801512
swpout_zero: 1660539
swpin_zero: 321367
refault_file: 651376
refault_anon: 16400826
*** Executing swappiness 140 ***
set swappiness to 140
Running as unit: run-p162871-i189610.scope; invocation ID:
3be1d782d9724eb79e7803eb72c47e4a
real 1m48.602s
user 38m31.708s
sys 21m39.510s
pswpin: 16376932
pswpout: 41921230
pgpgin: 70503000
pgpgout: 168528328
swpout_zero: 1684494
swpin_zero: 333271
refault_file: 524031
refault_anon: 16513067
*** Executing swappiness 175 ***
set swappiness to 175
Running as unit: run-p200958-i133720.scope; invocation ID:
12da6771f02b485ea6cf0c6842bd5f73
real 1m48.905s
user 38m28.887s
sys 21m31.592s
pswpin: 16535604
pswpout: 42244753
pgpgin: 70727968
pgpgout: 170088056
swpout_zero: 1675139
swpin_zero: 327897
refault_file: 489367
refault_anon: 16669662
*** Executing swappiness 200 ***
set swappiness to 200
Running as unit: run-p239041-i341992.scope; invocation ID:
31ff32be856f41f4a3ad60ea7878a230
real 1m48.746s
user 38m25.722s
sys 21m50.843s
pswpin: 16644335
pswpout: 42660348
pgpgin: 70911344
pgpgout: 171749444
swpout_zero: 1675432
swpin_zero: 321988
refault_file: 501717
refault_anon: 16775111
Since you mentioned it's mm-new vs mainline, and you have reverted
part of this series and the problem is still there. Could it be
related to something else in mm-new? I'll keep testing more stress and
workload to dig deeper too. Or maybe the swappiness behavior just
changed slightly, some it may perform better or worse depending on
timing and workload? Swappiness on MGLRU currently only works as a
factor for calculating the refault and reclaim balance of anon / file
so it may behave a bit unpredictable. There isn't a proportional
calculation like active / inactive LRU. That's a problem too, and we
might fix that later.