Binbin Wu <[email protected]> writes:

>
> [...snip...]
>
>> +static bool __folio_safe_for_conversion(struct folio *folio,
>> +                                    enum lru_cache_drained *drained)
>> +{
>> +    const int filemap_get_folios_refcount = 1;
>> +
>
> Nit:
> After adding the helper, the use of filemap_get_folios_refcount seems
> less obvious. It introduces unnecessary tight coupling with the caller,
> though it has only one caller currently.
>
> Is it better to pass the value as extra_refs, similar to what
> lru_cache_drain_for_folio() does?
>
>

David also suggested [1] something similar, please see
https://lore.kernel.org/all/[email protected]/,

Please add on to that thread if you disagree with the suggestions!

>> +    if (folio_maybe_dma_pinned(folio) || folio_mapped(folio))
>> +            return false;
>> +
>> +    lru_cache_drain_for_folio(folio, filemap_get_folios_refcount,
>> +                              drained);
>> +
>> +    return folio_ref_count(folio) ==
>> +           folio_nr_pages(folio) + filemap_get_folios_refcount;
>> +}
>> +
>>
>> [...snip...]
>>

Reply via email to