v5 (link below) calls inc_min_seq() in the correct order but rewrites in the later versions broke it. WARNING: CPU: 0 PID: 0 at ./include/linux/mm_types.h:613 context_switch+0x375/0x3e0 __schedule+0x443/0x610 schedule_idle+0x27/0x40 do_idle+0x322/0x360 cpu_startup_entry+0x65/0x70 rest_init+0x1e7/0x1f0 start_kernel+0x529/0x5a0 x86_64_start_reservations+0x13f/0x150 x86_64_start_kernel+0x1f2/0x200 secondary_startup_64+0xa6/0xb0 Link: https://lore.kernel.org/linux-mm/20211111041510.402534-7-yuzhao@xxxxxxxxxx/ Reported-by: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 8291808ec535..e509e896c019 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4307,7 +4307,7 @@ static void inc_max_seq(struct lruvec *lruvec, bool can_swap, bool force_scan) VM_WARN_ON_ONCE(!seq_is_valid(lruvec)); - for (type = 0; type < ANON_AND_FILE; type++) { + for (type = ANON_AND_FILE - 1; type >= 0; type--) { if (get_nr_gens(lruvec, type) != MAX_NR_GENS) continue; -- 2.37.3.968.ga6b4b080e4-goog