Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-18 Thread Hugh Dickins
On Tue, 16 Mar 2021, Peter Xu wrote: > > I'm curious whether it's okay to expand MREMAP_DONTUNMAP to PFNMAP too.. > E.g. vfio maps device MMIO regions with both VM_DONTEXPAND|VM_PFNMAP, to me it > makes sense to allow the userspace to get such MMIO region remapped/duplicated > somewhere else as lo

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-16 Thread Peter Xu
On Sat, Mar 13, 2021 at 08:19:38PM -0800, Hugh Dickins wrote: > On Wed, 3 Mar 2021, Brian Geffon wrote: > > > Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This > > change > > will widen the support to include shmem mappings. The primary use case > > is to support MREMAP_DON

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-16 Thread Dmitry Safonov
Hi Brian, Hugh, On 3/16/21 7:18 PM, Brian Geffon wrote: > Hi Hugh, > Thanks for this suggestion, responses in line. > >> A better patch would say: >> >> - if (flags & MREMAP_DONTUNMAP && (!vma_is_anonymous(vma) || >> - vma->vm_flags & VM_SHARED)) >> + if ((flags

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-16 Thread Brian Geffon
Hi Hugh, Thanks for this suggestion, responses in line. > A better patch would say: > > - if (flags & MREMAP_DONTUNMAP && (!vma_is_anonymous(vma) || > - vma->vm_flags & VM_SHARED)) > + if ((flags & MREMAP_DONTUNMAP) && > + (vma->vm_flags & (VM_DONTEXPAND

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-13 Thread Hugh Dickins
On Wed, 3 Mar 2021, Brian Geffon wrote: > Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This > change > will widen the support to include shmem mappings. The primary use case > is to support MREMAP_DONTUNMAP on mappings which may have been created from > a memfd. > > Lokesh

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-03 Thread Lokesh Gidra
On Wed, Mar 3, 2021 at 10:13 AM Brian Geffon wrote: > > I apologize, this patch didn't include my signed off by, here it is: > > Signed-off-by: Brian Geffon > > > On Wed, Mar 3, 2021 at 9:53 AM Brian Geffon wrote: > > > > Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-03 Thread Brian Geffon
I apologize, this patch didn't include my signed off by, here it is: Signed-off-by: Brian Geffon On Wed, Mar 3, 2021 at 9:53 AM Brian Geffon wrote: > > Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This > change > will widen the support to include shmem mappings. The pri

[PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-03 Thread Brian Geffon
Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This change will widen the support to include shmem mappings. The primary use case is to support MREMAP_DONTUNMAP on mappings which may have been created from a memfd. Lokesh Gidra who works on the Android JVM, provided an explana