[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89124a45-ddfd-9c96-1957-304f67d4b9bc@virtuozzo.com>
Date: Thu, 16 May 2019 16:56:46 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: Jann Horn <jannh@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Michal Hocko <mhocko@...e.com>, keith.busch@...el.com,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
pasha.tatashin@...cle.com,
Alexander Duyck <alexander.h.duyck@...ux.intel.com>,
ira.weiny@...el.com, Andrey Konovalov <andreyknvl@...gle.com>,
arunks@...eaurora.org, Vlastimil Babka <vbabka@...e.cz>,
Christoph Lameter <cl@...ux.com>,
Rik van Riel <riel@...riel.com>,
Kees Cook <keescook@...omium.org>, hannes@...xchg.org,
npiggin@...il.com,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Shakeel Butt <shakeelb@...gle.com>,
Roman Gushchin <guro@...com>,
Andrea Arcangeli <aarcange@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Jerome Glisse <jglisse@...hat.com>,
Mel Gorman <mgorman@...hsingularity.net>,
daniel.m.jordan@...cle.com,
kernel list <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux API <linux-api@...r.kernel.org>
Subject: Re: [PATCH RFC 0/5] mm: process_vm_mmap() -- syscall for duplication
a process mapping
On 16.05.2019 16:32, Jann Horn wrote:
> On Wed, May 15, 2019 at 5:11 PM Kirill Tkhai <ktkhai@...tuozzo.com> 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.
> [...]
>> The proposed syscall aims to introduce an interface, which
>> supplements currently existing process_vm_writev() and
>> process_vm_readv(), and allows to solve the problem with
>> anonymous memory transfer. The above example may be rewritten as:
>>
>> void *buf;
>>
>> buf = mmap(NULL, n * PAGE_SIZE, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_ANONYMOUS, ...);
>> recv(sock, buf, n * PAGE_SIZE, 0);
>>
>> /* Sign of @pid is direction: "from @pid task to current" or vice versa. */
>> process_vm_mmap(-pid, buf, n * PAGE_SIZE, remote_addr, PVMMAP_FIXED);
>> munmap(buf, n * PAGE_SIZE);
>
> In this specific example, an alternative would be to splice() from the
> socket into /proc/$pid/mem, or something like that, right?
> proc_mem_operations has no ->splice_read() at the moment, and it'd
> need that to be more efficient, but that could be built without
> creating new UAPI, right?
I have just never seen, a socket memory may be preempted into swap.
If so, there is a fundamental problem.
But, anyway, like you guessed below:
> But I guess maybe your workload is not that simple? What do you
> actually do with the received data between receiving it and shoving it
> over into the other process?
Data are usually sent encrypted and compressed by socket, so there is no
possibility to go this way. You may want to do everything with data,
before passing to another process.
Kirill
Powered by blists - more mailing lists