Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp388373pxb; Mon, 16 Aug 2021 07:45:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHx+biM+iHvlelwhjDrhgHsY2ke9eV2P6zLZSWNntesfOSC2ae6vaSPY8vKEylwEHFbb5+ X-Received: by 2002:a6b:8ec6:: with SMTP id q189mr12566177iod.169.1629125104044; Mon, 16 Aug 2021 07:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629125104; cv=none; d=google.com; s=arc-20160816; b=LM92o6R3ASL9Tm+g18qnkeK/mDFp8F+jehEAU1P2CDWSmuh6eoZnFMzFE4bSxPAkUM Tkecos/dg4bdKk4+zzoBwPOghq6xtG0MXcIFlD0pIwUjfMjHIGWGcxocHew8TRyc5una VFVRQinIV6khEPxCqxBlwrJc3JfDj/8Oe/uQVYNKDjq+ICn4FPMObz0Lf0oR1JJcsGmH 7SUEaDhlrKsh/EUDSa+gdbbw+vbh01FYTE7y+5KleNks4r/+kqVNyV6jRkgZuJ/NyuwH 9zhVXORj4DaHLn+zd2MPs3DdER4AgntWXoT/rJWKoR7ar01wg80HFLipBzG3bxcqPIVy u4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WEkk9bTRSPeIztpf1WOtGTbt+rB7VbtYlTiQl5in/5o=; b=aNMzPNBGAZ3axCc8xC095k8OUU0qH+gL3rVvmD0X7BbWuCCoqgm9fh1E9blqUOWAau Gkxo82hLlkWMt8vOeSJ1fA5ruIIWgIhyPaqcUkrxmoodOvF0hDbRAgHEPIf2Q4bQsTq2 dKNN1dy0AJtLPVTNfDTboSAXVPuxV//AiD4KwkdIqpBJ8RFPyT2gMCaakP8TGGjqi5Eo 2cWtiQFQZPPTYhLuiIPNLVaQXOc36s/gSyaiMAFM3EUW3FkYB8UJeVVVMEeis/qSIb5Y yGMXlwGsmeSR6i3/nJHkagx2O8JhJyjpiF5qArNlh0ZpI7XMU/fyG53AoiP/P4x/wWWp DO4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GN4Fvc2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si602940ila.73.2021.08.16.07.44.52; Mon, 16 Aug 2021 07:45:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GN4Fvc2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232346AbhHPOn4 (ORCPT + 99 others); Mon, 16 Aug 2021 10:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbhHPOnn (ORCPT ); Mon, 16 Aug 2021 10:43:43 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F38CC0613C1 for ; Mon, 16 Aug 2021 07:42:05 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.