Re: [PATCH v3 3/7] mm/mglru: enhance cold/hot inversion handling in inc_min_seq()
From: Baolin Wang
Date: Thu Sep 03 2026 - 08:11:33 EST
On 9/2/26 7:24 AM, Barry Song (Xiaomi) wrote:
During aging, a folio's generation may already have been updated by
folio_update_gen(), even though it has not yet been moved to the
corresponding generation list. Such folios are hotter than those
already in that generation.
It makes sense for inc_min_seq() to increment the generation of
folios that were never promoted during aging and move them to the
tail of the new oldest generation. However, folios that were already
promoted should instead be moved to the head of their updated
generation, just as sort_folio() does in scan_folios().
Otherwise, promoted folios could end up behind folios that were
never promoted, effectively inverting their hot/cold ordering.
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
Reviewed-by: Kairui Song <kasong@xxxxxxxxxxx>
Tested-by: Xueyuan Chen <xueyuan.chen21@xxxxxxxxx>
Reviewed-by: Ridong Chen <ridong.chen@xxxxxxxxx>
Reviewed-by: Lian Wang <lianux.mm@xxxxxxxxx>
---
Good catch. Make sense to me.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>