Re: [PATCH] mremap.2: MREMAP_DONTUNMAP to reflect to supported mappings

2021-03-26 Thread Brian Geffon
ot, as I've seen a patch of > yous for the kernel, right? > > Thanks, > > Alex > > On 3/23/21 7:25 PM, Brian Geffon wrote: > > mremap(2) now supports MREMAP_DONTUNMAP with mapping types other > > than private anonymous. > > > > Signed-off-by: Brian G

[PATCH] mremap.2: MREMAP_DONTUNMAP to reflect to supported mappings

2021-03-23 Thread Brian Geffon
mremap(2) now supports MREMAP_DONTUNMAP with mapping types other than private anonymous. Signed-off-by: Brian Geffon --- man2/mremap.2 | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/man2/mremap.2 b/man2/mremap.2 index 3ed0c0c0a..72acbc111 100644 --- a/man2

[PATCH v5 3/3] selftests: Add a MREMAP_DONTUNMAP selftest for shmem

2021-03-23 Thread Brian Geffon
This test extends the current mremap tests to validate that the MREMAP_DONTUNMAP operation can be performed on shmem mappings. Signed-off-by: Brian Geffon --- tools/testing/selftests/vm/mremap_dontunmap.c | 52 +++ 1 file changed, 52 insertions(+) diff --git a/tools/testing

[PATCH v5 2/3] Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio"

2021-03-23 Thread Brian Geffon
ve since expanded support of MREMAP_DONTUNMAP to non-anonymous mappings, and these special mappings are still protected by the existing check of !VM_DONTEXPAND and !VM_PFNMAP which will result in a -EINVAL. 1. https://lkml.org/lkml/2020/12/28/2340 Signed-off-by: Brian Geffon Acked-by: Hugh Dickins ---

[PATCH v5 1/3] mm: Extend MREMAP_DONTUNMAP to non-anonymous mappings

2021-03-23 Thread Brian Geffon
] https://lore.kernel.org/linux-mm/20210302000133.272579-1-axelrasmus...@google.com/ Signed-off-by: Brian Geffon Acked-by: Hugh Dickins Tested-by: Lokesh Gidra --- mm/mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index ec8f840399ed..db

[PATCH] mremap.2: MREMAP_DONTUNMAP to reflect to supported mappings

2021-03-23 Thread Brian Geffon
mremap(2) now supports MREMAP_DONTUNMAP with mapping types other than private anonymous. Signed-off-by: Brian Geffon --- man2/mremap.2 | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/man2/mremap.2 b/man2/mremap.2 index 3ed0c0c0a..72acbc111 100644 --- a/man2

[PATCH v4 1/3] mm: Extend MREMAP_DONTUNMAP to non-anonymous mappings

2021-03-23 Thread Brian Geffon
] https://lore.kernel.org/linux-mm/20210302000133.272579-1-axelrasmus...@google.com/ Signed-off-by: Brian Geffon Acked-by: Hugh Dickins Tested-by: Lokesh Gidra --- mm/mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index ec8f840399ed..db

[PATCH v4 3/3] selftests: Add a MREMAP_DONTUNMAP selftest for shmem

2021-03-23 Thread Brian Geffon
This test extends the current mremap tests to validate that the MREMAP_DONTUNMAP operation can be performed on shmem mappings. Signed-off-by: Brian Geffon --- tools/testing/selftests/vm/mremap_dontunmap.c | 52 +++ 1 file changed, 52 insertions(+) diff --git a/tools/testing

[PATCH v4 2/3] Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio"

2021-03-23 Thread Brian Geffon
ve since expanded support of MREMAP_DONTUNMAP to non-anonymous mappings, and these special mappings are still protected by the existing check of !VM_DONTEXPAND and !VM_PFNMAP which will result in a -EFAULT. 1. https://lkml.org/lkml/2020/12/28/2340 Signed-off-by: Brian Geffon Acked-by: Hugh Dickins ---

[PATCH v3 2/2] Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio"

2021-03-17 Thread Brian Geffon
ve since expanded support of MREMAP_DONTUNMAP to non-anonymous mappings, and these special mappings are still protected by the existing check of !VM_DONTEXPAND and !VM_PFNMAP which will result in a -EFAULT. 1. https://lkml.org/lkml/2020/12/28/2340 Signed-off-by: Brian Geffon --- arch/x86/kernel/cpu

[PATCH v3 1/2] mm: Allow non-VM_DONTEXPAND and VM_PFNMAP mappings with MREMAP_DONTUNMAP

2021-03-17 Thread Brian Geffon
, this patch will enable using UFFDIO_CONTINUE for the new userfaultfd-based heap compaction." [1] https://lore.kernel.org/linux-mm/20201215030730.nc3cu98e4%25a...@linux-foundation.org/ [2] https://lore.kernel.org/linux-mm/20210302000133.272579-1-axelrasmus...@google.com/ Signed-off-by: Brian Geffon

Re: [PATCH v2 1/2] mm: Allow non-VM_DONTEXPAND and VM_PFNMAP mappings with MREMAP_DONTUNMAP

2021-03-17 Thread Brian Geffon
You're 100% correct, I'll mail a new patch in a few Brian On Wed, Mar 17, 2021 at 5:19 PM Peter Xu wrote: > > On Wed, Mar 17, 2021 at 04:44:25PM -0400, Brian Geffon wrote: > > Hi Peter, > > Hi, Brian, > > > Thank you as always for taking a look. This chang

Re: [PATCH v2 1/2] mm: Allow non-VM_DONTEXPAND and VM_PFNMAP mappings with MREMAP_DONTUNMAP

2021-03-17 Thread Brian Geffon
PM Peter Xu wrote: > > Hi, Brian, > > On Wed, Mar 17, 2021 at 12:13:33PM -0700, Brian Geffon wrote: > > Currently MREMAP_DONTUNMAP only accepts private anonymous mappings. This > > change will widen the support to include any mappings which are not > > VM_DONTEXPAND

[PATCH v2 2/2] Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio"

2021-03-17 Thread Brian Geffon
ve since expanded support of MREMAP_DONTUNMAP to non-anonymous mappings, and these special mappings are still protected by the existing check of !VM_DONTEXPAND and !VM_PFNMAP which will result in a -EFAULT. 1. https://lkml.org/lkml/2020/12/28/2340 Signed-off-by: Brian Geffon --- arch/x86/kernel/cpu

[PATCH v2 1/2] mm: Allow non-VM_DONTEXPAND and VM_PFNMAP mappings with MREMAP_DONTUNMAP

2021-03-17 Thread Brian Geffon
201215030730.nc3cu98e4%25a...@linux-foundation.org/ [2] https://lore.kernel.org/linux-mm/20210302000133.272579-1-axelrasmus...@google.com/ Signed-off-by: Brian Geffon --- mm/mremap.c | 4 1 file changed, 4 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index ec8f840399ed..2c57dc4bc8b

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

[PATCH] eventfd: Introduce EFD_ZERO_ON_WAKE

2021-03-10 Thread Brian Geffon
a read is performed without EFD_NONBLOCK it will block until a write occurs. In both cases after the read completes successfully the internal value is reset to 0. When polling with POLLIN, upon return of a POLLIN event the internal value will be reset to 0. Signed-off-by: Brian G

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 sh

[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

Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-30 Thread Brian Geffon
Ah, you're right. This individual patch looks good to me. Brian On Mon, Dec 28, 2020 at 11:12 AM Dmitry Safonov wrote: > > On 12/28/20 6:21 PM, Brian Geffon wrote: > > This looks good to me with a small comment. > > > >> if (do_munmap(mm,

Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-28 Thread Brian Geffon
This looks good to me with a small comment. > if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { > /* OOM: unable to split vma, just get accounts right */ > - if (vm_flags & VM_ACCOUNT) > + if (vm_flags & VM_ACCOUNT && !(flags & MREMAP_DONTUNM

Re: [PATCH 3/6] mremap: Don't allow MREMAP_DONTUNMAP on special_mappings and aio

2020-12-28 Thread Brian Geffon
I don't think this situation can ever happen MREMAP_DONTUNMAP is already restricted to anonymous mappings (defined as not having vm_ops) and vma_to_resize checks that the mapping is anonymous before move_vma is called. On Mon, Oct 12, 2020 at 6:34 PM Dmitry Safonov wrote: > > As kernel expect t

Re: [PATCH] userfaultfd: fix remap event with MREMAP_DONTUNMAP.

2020-05-06 Thread Brian Geffon
> > - mremap_userfaultfd_complete(&uf, addr, new_addr, old_len); > > + mremap_userfaultfd_complete(&uf, addr, ret, old_len); > > Not super familiar with this code, but thought I'd ask, does ret > to be checked for -ENOMEM before calling mremap_userfaultfd_complete? > Sorry if I missed s

Re: [PATCH] userfaultfd: fix remap event with MREMAP_DONTUNMAP.

2020-05-06 Thread Brian Geffon
6, 2020 at 10:28 AM Joel Fernandes wrote: > > On Wed, May 6, 2020 at 1:22 PM Brian Geffon wrote: > > > > A user is not required to set a new address when using > > MREMAP_DONTUNMAP as it can be used without MREMAP_FIXED. > > When doing so the remap event will use

[PATCH] userfaultfd: fix remap event with MREMAP_DONTUNMAP.

2020-05-06 Thread Brian Geffon
e new address it's probably more correct to use it rather than new_addr on the remap_event_complete call, and it resolves this bug. Signed-off-by: Brian Geffon --- mm/mremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mremap.c b/mm/mremap.c index c881abeba0bf..6a

Re: [RFC 0/7] introduce memory hinting API for external process

2019-05-21 Thread Brian Geffon
To expand on the ChromeOS use case we're in a very similar situation to Android. For example, the Chrome browser uses a separate process for each individual tab (with some exceptions) and over time many tabs remain open in a back-grounded or idle state. Given that we have a lot of information about