Skip to contentSkip to conversation

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

PATCH Superseded Chris Li 3 participants 4 messages Sep 5, 2024

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chris Li

author
#0 lore raw

PATCH 1/1 mm: vmscan.c: fix OOM on swap stress test

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.

---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
index a9b6a8196f95..96abf4a52382 100644
@@ -4323,7 +4323,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;

---
base-commit: 756ca36d643324d028b325a170e73e392b9590cd
change-id: 20240904-lru-flag-2af2f955740e

Best regards,

Signature · 1 line
Chris Li <[email protected]>
#1 lore raw
Quoted 11 lines · Chris Li

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():"

Quoted 8 lines

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

#2 lore raw
Quoted 12 lines · Yu Zhao
Quoted 11 lines · Chris Li

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():"

Quoted 8 lines
Quoted 8 lines

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

Thx for taking care of this, Chris!

Quoted 1 line

FWIW, no big deal, but that ideally should be (in general and for regression tracking) the following instead, as that link above is just at the end of the thread with the report, but not the report itself -- and that is what often needed when someone needs to look up the backstory of this chance sooner or later:

Closes:
https://lore.kernel.org/all/CAF8kJuNP5iTj2p07QgHSGOJsiUfYpJ2f4R1Q5-3BN9JiD9W_KA@mail.gmail.com/

Ciao, Thorsten

author
#3 lore raw
Quoted 29 lines · Thorsten Leemhuis
Quoted 12 lines · Yu Zhao
Quoted 11 lines · Chris Li

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():"

Quoted 8 lines
Quoted 8 lines

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

Thx for taking care of this, Chris!

Quoted 1 line
Quoted 8 lines

FWIW, no big deal, but that ideally should be (in general and for regression tracking) the following instead, as that link above is just at the end of the thread with the report, but not the report itself -- and that is what often needed when someone needs to look up the backstory of this chance sooner or later:

Closes:
https://lore.kernel.org/all/CAF8kJuNP5iTj2p07QgHSGOJsiUfYpJ2f4R1Q5-3BN9JiD9W_KA@mail.gmail.com/

Thanks you Yu and Thorsten,

I just submitted the V2 to include the Closes tag. Technically it passes midnight here so it is another day I can submit another version :-).

Chris