Migration moves PG_dirty to the new folio but not PG_dropbehind, so a migrated dirty dropbehind folio is cleaned without decrementing WB_DONTCACHE_DIRTY. The counter leaks, and every later RWF_DONTCACHE kick asks the flusher for that many more pages. Copy the flag along with PG_dirty, before the new folio becomes visible. With RWF_DONTCACHE writes and compaction running for five minutes, 1313 to 1709 pages leaked, all of them migrated. Fixes: 88d6f128d06d ("mm: track DONTCACHE dirty pages per bdi_writeback") Cc: stable@vger.kernel.org Signed-off-by: Usama Arif --- mm/migrate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index 96b66a272379f9..81a8e46778610f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -663,6 +663,9 @@ static int __folio_migrate_mapping(struct address_space *mapping, folio_clear_dirty(folio); folio_set_dirty(newfolio); } + /* WB_DONTCACHE_DIRTY counts pages that are both dirty and dropbehind */ + if (folio_test_dropbehind(folio)) + folio_set_dropbehind(newfolio); if (folio_test_swapcache(folio)) __swap_cache_replace_folio(ci, folio, newfolio); -- 2.53.1-Meta