Re: [PATCH v3 8/9] mm/rmap: Add batched version of folio_try_share_anon_rmap_pte

From: David Hildenbrand (Arm)

Date: Mon May 11 2026 - 04:16:07 EST



>
> Something called folio that doesn't consume a folio is odd. I'd prefer we don't add this.
>
> Is there a chance to simply change __folio_try_share_anon_rmap, so we get a single loop
> inline?
>
> diff --git a/include/linux/rmap.h b/include/linux/rmap.h
> index 8dc0871e5f00..5a1c874b2112 100644
> --- a/include/linux/rmap.h
> +++ b/include/linux/rmap.h
> @@ -708,16 +708,13 @@ static inline int folio_try_dup_anon_rmap_pmd(struct folio *folio,
> static __always_inline int __folio_try_share_anon_rmap(struct folio *folio,
> struct page *page, int nr_pages, enum pgtable_level level)
> {
> + /* device private folios cannot get pinned via GUP. */
> + const bool pinnable = !folio_is_device_private(folio);
> +

Throw in likely() to keep that unchanged.

--
Cheers,

David