Binbin Wu [off-list ref] writes:
[...snip...]
quoted
+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/4c638fc5-5a74-43d0-b5bf-d7ef893cb994@kernel.org/ (local),
Please add on to that thread if you disagree with the suggestions!
quoted
+ 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...]