Re: [PATCH v1 16/16] mm/memory: support VM_MIXEDMAP in zap_special_vma_range()

"Lorenzo Stoakes (Oracle)" <[email protected]> Fri, 6 Mar 2026 12:43:21 +0000
Newsgroups org.kernel.vger.linux-sgx,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-gfx,org.kernel.vger.bpf,org.kernel.vger.kvm,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-perf-users,org.kernel.vger.linux-rdma,org.kernel.vger.linux-s390,org.kernel.vger.netdev,org.kernel.vger.rust-for-linux,org.kvack.linux-mm,org.ozlabs.lists.linuxppc-dev
Message-ID <[email protected]>
On Fri, Feb 27, 2026 at 09:08:47PM +0100, David Hildenbrand (Arm) wrote:
> There is demand for also zapping page table entries by drivers in
> VM_MIXEDMAP VMAs[1].
>
> Nothing really speaks against supporting VM_MIXEDMAP for driver use. We
> just don't want arbitrary drivers to zap in ordinary (non-special) VMAs.
>
> [1] https://lore.kernel.org/r/[email protected]

Dude, you have to start your indices with 0 what kind of programmer are
you? ;)

>
> Signed-off-by: David Hildenbrand (Arm) <[email protected]>

Agreed that there's no reason not to allow this, so LGTM and:

Reviewed-by: Lorenzo Stoakes (Oracle) <[email protected]>

Thanks for this series overall, very nice cleanup and I was frustra^Whappy
to see that there was nothing major or really of note to comment on here, a
rare occurrence in review :)

> ---
>  mm/memory.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index f3b7b7e16138..3fe30dc2f179 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2239,13 +2239,13 @@ void zap_vma_range(struct vm_area_struct *vma, unsigned long address,
>   * @size: number of bytes to zap
>   *
>   * This function does nothing when the provided address range is not fully
> - * contained in @vma, or when the @vma is not VM_PFNMAP.
> + * contained in @vma, or when the @vma is not VM_PFNMAP or VM_MIXEDMAP.
>   */
>  void zap_special_vma_range(struct vm_area_struct *vma, unsigned long address,
>  		unsigned long size)
>  {
>  	if (!range_in_vma(vma, address, address + size) ||
> -	    		!(vma->vm_flags & VM_PFNMAP))
> +	   !(vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)))
>  		return;
>
>  	zap_vma_range(vma, address, size);
> --
> 2.43.0
>

Cheers, Lorenzo