Skip to contentSkip to conversation

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

PATCH In review Chris Li 3 participants 3 messages Oct 16, 2024 – Oct 18, 2024 Stable branch

lore
Share & tools
lore

Chris Li

author
#0 lore raw

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

[ Upstream commit 0885ef4705607936fc36a38fd74356e1c465b023 ]

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 bd489c1af2289..a8d61a8b68944 100644
@@ -4300,7 +4300,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: 8e24a758d14c0b1cd42ab0aea980a1030eea811f
change-id: 20241015-stable-oom-fix-a6ab273b1817

Best regards,

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

[ Upstream commit 0885ef4705607936fc36a38fd74356e1c465b023 ]

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.

Quoted 3 lines
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Again, for mm changes, we need an explicit ack from the mm maintainers before we can take them. I'll wait for that.

thanks,

greg k-h

#2 lore raw
Quoted 27 lines · On Fri, 18 Oct 2024 10:51:30 +0200 Greg KH <[email protected]> wrote:
Quoted 22 lines · Chris Li

[ Upstream commit 0885ef4705607936fc36a38fd74356e1c465b023 ]

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.

Quoted 3 lines
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 2 lines

Again, for mm changes, we need an explicit ack from the mm maintainers before we can take them. I'll wait for that.

Yes, please proceed with the backport. It looks like the cc:stable got lost because it wasn't in the original commit.

btw Chris, that was a quite poor changelog. It didn't explain the code change at all!