Commit c543ecb3 authored by Chris Li's avatar Chris Li Committed by hanliyang
Browse files

mm: vmscan.c: fix OOM on swap stress test

mainline inclusion
from mainline-v6.12
commit 0885ef4705607936fc36a38fd74356e1c465b023
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAEY2C
CVE: NA

---------------------------

I found a regression on mm-unstable during my swap stress test, using
tmpfs to compile linux.  The test OOM very soon after the make spawns many
cc processes.

It bisects down to this change: 33dfe9204f29b415bbc0abb1a50642d1ba94f5e9
(mm/gup: clear the LRU flag of a page before adding to LRU batch)

Yu Zhao propose the fix: "I think this is one of the potential side
effects -- Huge mentioned earlier about isolate_lru_folios():"

I test that with it the swap stress test no longer OOM.

Link: https://lore.kernel.org/r/CAOUHufYi9h0kz5uW3LHHS3ZrVwEq-kKp8S6N-MZUmErNAXoXmw@mail.gmail.com/
Link: https://lkml.kernel.org/r/20240905-lru-flag-v2-1-8a2d9046c594@kernel.org


Fixes: 33dfe9204f29 ("mm/gup: clear the LRU flag of a page before adding to LRU batch")
Signed-off-by: default avatarChris Li <chrisl@kernel.org>
Suggested-by: default avatarYu Zhao <yuzhao@google.com>
Suggested-by: default avatarHugh Dickins <hughd@google.com>
Closes: https://lore.kernel.org/all/CAF8kJuNP5iTj2p07QgHSGOJsiUfYpJ2f4R1Q5-3BN9JiD9W_KA@mail.gmail.com/


Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarhanliyang <hanliyang@hygon.cn>
parent 0286112c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5001,7 +5001,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c
	}

	/* ineligible */
	if (zone > sc->reclaim_idx) {
	if (!folio_test_lru(folio) || zone > sc->reclaim_idx) {
		gen = folio_inc_gen(lruvec, folio, false);
		list_move_tail(&folio->lru, &lrugen->folios[gen][type][zone]);
		return true;