Re: [PATCH RFC 0/5] mm: process_vm_mmap() -- syscall for duplication a process mapping
- Date: Wed, 15 May 2019 20:46:35 +0200
- From: Jann Horn <jannh@xxxxxxxxxx>
- Subject: Re: [PATCH RFC 0/5] mm: process_vm_mmap() -- syscall for duplication a process mapping
On Wed, May 15, 2019 at 5:11 PM Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> wrote:
> This patchset adds a new syscall, which makes possible
> to clone a mapping from a process to another process.
> The syscall supplements the functionality provided
> by process_vm_writev() and process_vm_readv() syscalls,
> and it may be useful in many situation.
> For example, it allows to make a zero copy of data,
> when process_vm_writev() was previously used:
> This syscall may be used for page servers like in example
> above, for migration (I assume, even virtual machines may
> want something like this), for zero-copy desiring users
> of process_vm_writev() and process_vm_readv(), for debug
> purposes, etc. It requires the same permittions like
> existing proc_vm_xxx() syscalls have.
Have you considered using userfaultfd instead? userfaultfd has
interfaces (UFFDIO_COPY and UFFDIO_ZERO) for directly shoving pages
into the VMAs of other processes. This works without the churn of
creating and merging VMAs all the time. userfaultfd is the interface
that was written to support virtual machine migration (and it supports
live migration, too).