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 EA78DC4338F for ; Mon, 16 Aug 2021 12:48:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5544363275 for ; Mon, 16 Aug 2021 12:48:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5544363275 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 D32F08D0001; Mon, 16 Aug 2021 08:48:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE3B26B0073; Mon, 16 Aug 2021 08:48:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD1878D0001; Mon, 16 Aug 2021 08:48:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 9F2D56B0072 for ; Mon, 16 Aug 2021 08:48:02 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 43BA18249980 for ; Mon, 16 Aug 2021 12:48:02 +0000 (UTC) X-FDA: 78480921204.01.E768B82 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id C4D457026173 for ; Mon, 16 Aug 2021 12:48:01 +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=bYq/RlC0v6fhXkriJhOA5FB18MNbZK+nNft2JpmIjus=; b=Y2Zhk1IHVOkWh9NnpfC0ISuW5/ M0jdQhL8RnDw0UUxSX6Fs7mqN2zpfMGbaBMZNFHohfaOBozVVF42/fX9ztpM1wjP3q1LVDG1waAkY urC4/xfB47ZHbbgqkMwL9f2M7LIaLNnZQCQy5zldDcS5LFcWkO2oCYcg3gUIBu9OpP8zhtRAIDGM9 4o5hlig3wtT65q4DI/H239cmXwfXiehARu85+ypLOrvzCaB355FjjUqyudZVMn+2Ko7gHtBoSw/DR vf2+ltvQsv4iIDVmIK1fcZiSYFXWtFlSn19f+pyQFlyvS3grtV7cqaGBUArYN4z+HUgsVVX02tAJR jMhD7lgg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFc0U-001M88-Ca; Mon, 16 Aug 2021 12:46:27 +0000 Date: Mon, 16 Aug 2021 13:46:22 +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: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C4D457026173 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Y2Zhk1IH; spf=none (imf27.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: sh1zuymtyewqeyd8rzk3qgcs4ezn6tgs X-HE-Tag: 1629118081-176295 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 02:20:43PM +0200, David Hildenbrand wrote: > On 16.08.21 14:07, Matthew Wilcox wrote: > > On Mon, Aug 16, 2021 at 10:02:22AM +0200, David Hildenbrand wrote: > > > > 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. The first process that > > > > declares an address range mshare'd can continue to map objects in the > > > > shared area. All other processes that want mshare'd access to this > > > > memory area can do so by calling mshare(). After this call, the > > > > address range given by mshare becomes a shared range in its address > > > > space. Anonymous mappings will be shared and not COWed. > > > > > > Did I understand correctly that you want to share actual page tables between > > > processes and consequently different MMs? That sounds like a very bad idea. > > > > That is the entire point. Consider a machine with 10,000 instances > > of an application running (process model, not thread model). If each > > application wants to map 1TB of RAM using 2MB pages, that's 4MB of page > > tables per process or 40GB of RAM for the whole machine. > > What speaks against 1 GB pages then? Until recently, the CPUs only having 4 1GB TLB entries. I'm sure we still have customers using that generation of CPUs. 2MB pages perform better than 1GB pages on the previous generation of hardware, and I haven't seen numbers for the next generation yet. > > There's a reason hugetlbfs was enhanced to allow this page table sharing. > > I'm not a fan of the implementation as it gets some locks upside down, > > so this is an attempt to generalise the concept beyond hugetlbfs. > > Who do we account the page tables to? What are MADV_DONTNEED semantics? Who > cleans up the page tables? What happens during munmap? How does the rmap > even work? How to we actually synchronize page table walkers? > > See how hugetlbfs just doesn't raise these problems because we are sharing > pages and not page tables? No, really, hugetlbfs shares page tables already. You just didn't notice that yet. > > Think of it like partial threading. You get to share some parts, but not > > all, of your address space with your fellow processes. Obviously you > > don't want to expose this to random other processes, only to other > > instances of yourself being run as the same user. > > Sounds like a nice way to over-complicate MM to optimize for some special > use cases. I know, I'm probably wrong. :) It's really not as bad as you seem to think it is.