Re: [PATCH 08/17] mm/filemap: add read support for RWF_UNCACHED

Kirill A. Shutemov
2024-11-15T08:49:18Z

On Thu, Nov 14, 2024 at 08:25:12AM -0700, Jens Axboe wrote:
> @@ -2595,6 +2601,20 @@ static inline bool pos_same_folio(loff_t pos1, loff_t pos2, struct folio *folio)
> return (pos1 >> shift == pos2 >> shift);
> }
>
> +static void filemap_uncached_read(struct address_space *mapping,
> + struct folio *folio)
> +{
> + if (!folio_test_uncached(folio))
> + return;
> + if (folio_test_writeback(folio))
> + return;

Do we want to drop out here if the folio is dirty, but not yet under
writeback?

It is checked inside folio_unmap_invalidate(), but we will lose
PG_uncached if we get there.

> + if (folio_test_clear_uncached(folio)) {
> + folio_lock(folio);
> + folio_unmap_invalidate(mapping, folio, 0);
> + folio_unlock(folio);
> + }
> +}
> +
> /**
> * filemap_read - Read data from the page cache.
> * @iocb: The iocb to read.

--
Kiryl Shutsemau / Kirill A. Shutemov