@@ -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);
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@kernel.dk> --- mm/filemap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)