[PATCH] mm:vmscan: fix shrink sc unqueued_dirty counter issue
From: Zhiguo Jiang
Date: Wed Nov 29 2023 - 21:10:05 EST
It is needed to ensure sc->nr.unqueued_dirty > 0 first, which can avoid to
set PGDAT_DIRTY flag when both sc->nr.unqueued_dirty and sc->nr.file_taken
are zero at the same time.
Signed-off-by: Zhiguo Jiang <justinjiang@xxxxxxxx>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
mode change 100644 => 100755 mm/vmscan.c
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d8c3338fee0f..8b0c4d025c76
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5915,7 +5915,7 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
set_bit(PGDAT_WRITEBACK, &pgdat->flags);
/* Allow kswapd to start writing pages during reclaim.*/
- if (sc->nr.unqueued_dirty == sc->nr.file_taken)
+ if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken)
set_bit(PGDAT_DIRTY, &pgdat->flags);
/*
--
2.39.0