From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEC59C4338F for ; Mon, 16 Aug 2021 14:42:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 64C6560FC3 for ; Mon, 16 Aug 2021 14:42:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 64C6560FC3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DC3C58D0002; Mon, 16 Aug 2021 10:42:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D742C8D0001; Mon, 16 Aug 2021 10:42:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C636D8D0002; Mon, 16 Aug 2021 10:42:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id A97468D0001 for ; Mon, 16 Aug 2021 10:42:14 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 539F01829B8E2 for ; Mon, 16 Aug 2021 14:42:14 +0000 (UTC) X-FDA: 78481208988.34.09663EC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id E4A2A70080E5 for ; Mon, 16 Aug 2021 14:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WEkk9bTRSPeIztpf1WOtGTbt+rB7VbtYlTiQl5in/5o=; b=GN4Fvc2ClJf2hxkpESl7npbmyY 7UDRJDgS9s6lwS74oxsT2qgbCmZXrAUTPn1G61FqkgE4dW8DPc3gwE0UWVJRJpEVIrPuMa+LJYKUc 3DCXx4TUysvoLi/Eg/KuVwjCPO+kJDZFPbLd4nQqbH4gj/vdp5ULf3l2gV6x9PZrRqupSSyWt5QUg cUTXuKaPQD4/oJHEK+0mpbzevDfxhcrAWJgN3QxqNjO5mLG4jDHs9vL9LU7tpQPT6DNWpu5s9Si+3 kWBFaCER/CYTWba7I59U0s5ELs2gVWCAsOzSOCqpT9kl+/SEhYwxN14GJTjsdt0mzaCeILN7F/l0K SU25MxsQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFdnM-001UOc-NM; Mon, 16 Aug 2021 14:41:02 +0000 Date: Mon, 16 Aug 2021 15:40:56 +0100 From: Matthew Wilcox To: David Hildenbrand Cc: Khalid Aziz , "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" , Steven Sistare , Anthony Yznaga , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "Gonglei (Arei)" Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC Message-ID: References: <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> <88884f55-4991-11a9-d330-5d1ed9d5e688@redhat.com> <40bad572-501d-e4cf-80e3-9a8daa98dc7e@redhat.com> <3ce1f52f-d84d-49ba-c027-058266e16d81@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ce1f52f-d84d-49ba-c027-058266e16d81@redhat.com> X-Rspamd-Queue-Id: E4A2A70080E5 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=GN4Fvc2C; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam01 X-Stat-Signature: n3i79ot1hpmnbn4nzpkkdayyiwbe6dez X-HE-Tag: 1629124933-291104 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 16, 2021 at 04:33:09PM +0200, David Hildenbrand wrote: > > > I did not follow why we have to play games with MAP_PRIVATE, and having > > > private anonymous pages shared between processes that don't COW, introducing > > > new syscalls etc. > > > > It's not about SHMEM, it's about file-backed pages on regular > > filesystems. I don't want to have XFS, ext4 and btrfs all with their > > own implementations of ARCH_WANT_HUGE_PMD_SHARE. > > Let me ask this way: why do we have to play such games with MAP_PRIVATE? Are you referring to this? : Mappings within this address range behave as if they were shared : between threads, so a write to a MAP_PRIVATE mapping will create a : page which is shared between all the sharers. If so, that's a misunderstanding, because there are no games being played. What Khalid's saying there is that because the page tables are already shared for that range of address space, the COW of a MAP_PRIVATE will create a new page, but that page will be shared between all the sharers. The second write to a MAP_PRIVATE page (by any of the sharers) will not create a COW situation. Just like if all the sharers were threads of the same process.