[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241108174505.1214230-10-axboe@kernel.dk>
Date: Fri, 8 Nov 2024 10:43:32 -0700
From: Jens Axboe <axboe@...nel.dk>
To: linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Cc: hannes@...xchg.org,
clm@...a.com,
linux-kernel@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 09/13] mm: drop uncached pages when writeback completes
If the folio is marked as uncached, drop pages when writeback completes.
Intended to be used with RWF_UNCACHED, to avoid needing sync writes for
uncached IO.
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
mm/filemap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c
index 6f65025782bb..1e455ca872b5 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1634,6 +1634,18 @@ void folio_end_writeback(struct folio *folio)
if (__folio_end_writeback(folio))
folio_wake_bit(folio, PG_writeback);
acct_reclaim_writeback(folio);
+
+ /*
+ * If folio is marked as uncached, then pages should be dropped when
+ * writeback completes. Do that now.
+ */
+ if (folio_test_uncached(folio)) {
+ folio_lock(folio);
+ if (invalidate_complete_folio2(folio->mapping, folio, 0))
+ folio_clear_uncached(folio);
+ folio_unlock(folio);
+
+ }
folio_put(folio);
}
EXPORT_SYMBOL(folio_end_writeback);
--
2.45.2
Powered by blists - more mailing lists