Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp649277yba; Thu, 16 May 2019 06:54:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyowhBQ1dTBc/EZACsOopCUWQ77hbOK9i3SAwl3/suUwzepqXwt1nN5osVX7/gICurd00+Q X-Received: by 2002:a63:d252:: with SMTP id t18mr51149278pgi.131.1558014885793; Thu, 16 May 2019 06:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558014885; cv=none; d=google.com; s=arc-20160816; b=J3lRXE7ZIqfjPKHg/WZ4qy1r5KMH80GKlVq2DxKnQxXPpONj916ZZ0EOWXa+K19B3Y +JTvX84qI2nDb8da/UvTTwaSyL4axRYx86uOnZST2uIT0pSKNb0DPUMdL7k03ehFtaFy pM1ur4ul+v//fjB8T67rtgULq5OdM5vxjiWRaoWFzWBJsBCqLMrIN5Rxc4nn0FDbvSeW k9+DDzXl+rDP/TpDY9n2jo9qRi+h/OWQcMfk3Bmq0sCRxkEA1FcZFYmyFcqt6mAy0b6W nLDh2MGeP9RE+z4zh+I+gJGH5Xf8izIPmiu6ABEoVPN7sl2+CEoRABAu4UauSfsmBvxo FO/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=snYW1g8gu8OplU4wIoMhWxb6FV3JCp+3b3cHwZuPClc=; b=SGCOf7ljMV2FRTkt/lAaFw3AfAfRTsYEb6bzJK2j21pVMFfJVHLPGti2hPrNSMxDFs 8lxEN6iQHCycGMniKNNsB8k7hmDpLMk8lI3V29oE2vuIDAO6PjhBSf/WOa4o2DHaSme8 5My6Ews7dF8zoKc9y1IlGi4QbyUSO21BBCs1e3BtJ7pN8fr2bocZmZu/LOsqaDxpvn3S l+mr5jj7WOq3rKvQASWIX4ggn89FCQWT/ofUIsnw98Yfl/a2hPwXkxVDfjyoQ+hIzRqK pVcd9xPk2QW1eQS2puD9eq5CGdpI3nj5hyrwKG9R1Q0M0765GxtKSBq0ShlEop+rrYk5 +70w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si4778629pgp.466.2019.05.16.06.54.29; Thu, 16 May 2019 06:54:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbfEPNxI (ORCPT + 99 others); Thu, 16 May 2019 09:53:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:34858 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726692AbfEPNxH (ORCPT ); Thu, 16 May 2019 09:53:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 06CCAAED7; Thu, 16 May 2019 13:53:05 +0000 (UTC) Date: Thu, 16 May 2019 15:52:59 +0200 From: Michal Hocko To: Kirill Tkhai Cc: akpm@linux-foundation.org, dan.j.williams@intel.com, keith.busch@intel.com, kirill.shutemov@linux.intel.com, pasha.tatashin@oracle.com, alexander.h.duyck@linux.intel.com, ira.weiny@intel.com, andreyknvl@google.com, arunks@codeaurora.org, vbabka@suse.cz, cl@linux.com, riel@surriel.com, keescook@chromium.org, hannes@cmpxchg.org, npiggin@gmail.com, mathieu.desnoyers@efficios.com, shakeelb@google.com, guro@fb.com, aarcange@redhat.com, hughd@google.com, jglisse@redhat.com, mgorman@techsingularity.net, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: Re: [PATCH RFC 0/5] mm: process_vm_mmap() -- syscall for duplication a process mapping Message-ID: <20190516135259.GU16651@dhcp22.suse.cz> References: <155793276388.13922.18064660723547377633.stgit@localhost.localdomain> <20190516133034.GT16651@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190516133034.GT16651@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 16-05-19 15:30:34, Michal Hocko wrote: > [You are defining a new user visible API, please always add linux-api > mailing list - now done] > > On Wed 15-05-19 18:11:15, Kirill Tkhai wrote: [...] > > 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); AFAIU this means that you actually want to do an mmap of an anonymous memory with a COW semantic to the remote process right? How does the remote process find out where and what has been mmaped? What if the range collides? This sounds quite scary to me TBH. Why cannot you simply use shared memory for that? -- Michal Hocko SUSE Labs