Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp268211pxb; Mon, 16 Aug 2021 05:12:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztFgP063MQrwVa4uumO01OmoXDIbZUaL8Q4/iYUuUtUIr4bD5xhExegfTVl9Rk8f1DddFx X-Received: by 2002:a02:860d:: with SMTP id e13mr15492066jai.12.1629115920643; Mon, 16 Aug 2021 05:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629115920; cv=none; d=google.com; s=arc-20160816; b=zthm1j1IRj+7kjYWNyLoSfW9NzatMDDgozQ+rnqS4bO2IFQwG1hc1qDAh81mefaIGn zhOiZbB8CVFQZbGLwCXoSrvb4jK105Pc1ledyvH3O2R4jm4FsPzNJPunt/ydrHFE+D90 XSkyPUo5avcRBZYFAeH9t1P3+AZQX2IID/IUTDuv/D/FpeVyBMqT3nvaabCgdq1NrgwC LCuslzvrqRLRleElY7b2LRB5N8hf0XCA9G7XUXkPeqtnOtMh1Nt+0SRUA916EIrYGx8p 14ctJYO+H9Lbu17Nlygaml56Xf4Yc/tNMGzszsmtPJJkbrZV2g6ySYNXieK8JWE911N8 tFVw== 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=EO3WapSK214OZ9yh3pHLXXJh6QKbdMb2/Uqc1lKIh/c=; b=wF38WlCmAT3JK9EEtPjQfs8nW7Bi/iU3pzuzNA0piu94IppYeU6PoFirvATv8HiTYL aFWhL99LQVp24s7YBFO2UqAGceYoPavOVs257KJsDil4IlFKkd+uEuEZWrBUx251kn5M 6b6tsOgkVPBJbGJj0qWp9Z5FR4uZ8FRmQhvFmLJtWH6dZ+X25gUwbcXngosyPqNstLSk oq5Je4Ntw0S0qG4zN2eTVmctoKPVHjnkBl51L+6wUXeoqtReCJQQqWBdNf31ceikDZVJ 2r9F+qth+Cb9iZICFNVOtLZB2V4heAOuahhGUlw4KRUPl7h6Bswg0D6bLWDSqWYwvnde eYzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QjKfc84j; 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 o1si11553172ill.7.2021.08.16.05.11.49; Mon, 16 Aug 2021 05:12:00 -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=QjKfc84j; 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 S233151AbhHPMJ0 (ORCPT + 99 others); Mon, 16 Aug 2021 08:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbhHPMJZ (ORCPT ); Mon, 16 Aug 2021 08:09:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42B70C0613C1 for ; Mon, 16 Aug 2021 05:08:54 -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=EO3WapSK214OZ9yh3pHLXXJh6QKbdMb2/Uqc1lKIh/c=; b=QjKfc84jzubJb9dS0JcOUg50yA KdaOH+hqZoNr9IsKlJS1TM1iTVVrydrA5I0mh3aTtakVyxT8SH7iGjZsNdbwsoCX8tg5ZMj9Y3CbZ dFvwbE4VZ/e0N9wxoKIfsNZcHe9FA9f5szf2TRGcl8EeLHP0WjlOghTcbWV8JN50Osk3GS3PErZbI gTxntBeIL+afLxzLO8oyXZvRGoj76wC/2Gs0J/Vb23V4BKzU3TC/qtfhXXKQOq72gWjpN1D1xEz/g wq3iIVZR4DTacAFD8/PqyXL95zgKDWT0zRZAHO9G+/QERVj/B8uknat5q1nFCcWuCyc6KPdKMrCKE EGTwfjFg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFbPK-001K7e-82; Mon, 16 Aug 2021 12:08:13 +0000 Date: Mon, 16 Aug 2021 13:07:58 +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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. 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.