Re: [PATCH v5 02/16] mm: provide vma_[flags_]is_cow_mapping() and remove is_cow_mapping()
From: Lorenzo Stoakes (ARM)
Date: Thu Aug 20 2026 - 08:42:42 EST
(trim cc-list)
On Thu, Aug 13, 2026 at 06:32:19PM +0100, Lorenzo Stoakes (ARM) wrote:
...
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index df78847f5f07..199d0a64b14a 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2271,17 +2271,76 @@ void unpin_user_pages(struct page **pages, unsigned long npages);
> void unpin_user_folio(struct folio *folio, unsigned long npages);
> void unpin_folios(struct folio **folios, unsigned long nfolios);
>
...
> +/**
> + * vma_is_cow_mapping() - Is this VMA a CoW mapping?
> + * @desc: The VMA to check.
Andrew - a small typo here, this should be @vma not @desc, are you still to fix
this in place? If not can always send a fixup patch next cycle :))
(Credit to David's scripts for finding this! :)
> + *
> + * See vma_flags_is_cow_mapping() for details.
> + *
> + * Returns: true if the VMA is a CoW mapping, otherwise false.
> + */
> +static inline bool vma_is_cow_mapping(const struct vm_area_struct *vma)
> {
> - return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
> + return vma_flags_is_cow_mapping(&vma->flags);
> }
>
--
Cheers, Lorenzo