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

Jens Axboe
2024-11-15T15:01:37Z

On 11/15/24 1:49 AM, Kirill A. Shutemov wrote:
> 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.

True, seems prudent to skip if it's dirty as well, if only to avoid
losing uncached for that particular case. I'll add the tweak, thanks.

--
Jens Axboe