mm/vmscan: avoid false warning when aging races advance max_seq
Subsystems (4)
PATCH 1/1 mm/vmscan: avoid false warning when aging races advance max_seq
From: <Ehab Ababneh> <[email protected]>
try_to_inc_max_seq() assumes that if an MM-list iteration finishes, the following inc_max_seq() must succeed. That is not always true.
A concurrent aging pass can advance lrugen->max_seq after iterate_mm_list() returns success but before the local inc_max_seq() call takes the lock. In that case inc_max_seq() returns false because seq is stale, even though the generation has already been advanced and the warning is spurious.
This can show up in kswapd as:
WARNING: mm/vmscan.c:4076 at try_to_inc_max_seq+0x5d6/0x6c0
Treat an already advanced max_seq as success and keep returning false only when the generation was not advanced at all.
Fixes 61dd3f246b3a ("mm/mglru: add CONFIG_LRU_GEN_WALKS_MMU")
Signed-off-by <Ehab Ababneh> <[email protected]>
--- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/vmscan.c +3 -1
@@ -4073,7 +4073,9 @@ static bool try_to_inc_max_seq(struct lruvec *lruvec, unsigned long seq, done:if (success) { success =inc_max_seq (lruvec, seq, swappiness); -WARN_ON_ONCE (!success); +if (!success) +/* A concurrent aging pass may have advanced max_seq first. */ + success = seq <READ_ONCE (lrugen->max_seq); }return success;
Signature · 1 line
2.49.0