[v2] mm: fix shrink nr.unqueued_dirty counter issue

Message ID 20240102011939.1026-1-justinjiang@vivo.com
State New
Headers
Series [v2] mm: fix shrink nr.unqueued_dirty counter issue |

Commit Message

Zhiguo Jiang Jan. 2, 2024, 1:19 a.m. UTC
  It is needed to ensure sc->nr.unqueued_dirty > 0, which can avoid to
set PGDAT_DIRTY flag when sc->nr.unqueued_dirty and sc->nr.file_taken
are both zero at the same time.

Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com>
---
Changelogļ¼š
v1->v2:
Update based on the latest version.

 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 mm/vmscan.c
  

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index b4ca3563bcf4..c00418e34dc3
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5914,7 +5914,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);
 
 		/*