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=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 88984C4338F for ; Mon, 16 Aug 2021 12:20:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B06E63249 for ; Mon, 16 Aug 2021 12:20:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0B06E63249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8BDC76B0071; Mon, 16 Aug 2021 08:20:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86CE76B0072; Mon, 16 Aug 2021 08:20:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 734138D0001; Mon, 16 Aug 2021 08:20:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 5CEBD6B0071 for ; Mon, 16 Aug 2021 08:20:48 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0CBBD18200A1D for ; Mon, 16 Aug 2021 12:20:48 +0000 (UTC) X-FDA: 78480852576.11.8D61896 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 85B2F5007E8B for ; Mon, 16 Aug 2021 12:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629116446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/l26ZOlW3xGU7zJl7RKCGpKoJ9rKEPFiPOxBz7+D6xk=; b=KMFX3Frb62PHIOS1bSGAXER/5KkHoPZGYYD0Oa5P/uaqvb4sY3+oV2lb9QoiXt+ZHQBdcT QHV+OgxTqSi5QkG5z51BnS5fxtqhkKFRCost4L5v6FTe6lKkNjvBWlBpQFmZYywz7wSez8 NBS6kzxHz1bDraDMinoTh2SsXx/SOCk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-2AUn3DcZMAuZ5CF8fgOfsQ-1; Mon, 16 Aug 2021 08:20:45 -0400 X-MC-Unique: 2AUn3DcZMAuZ5CF8fgOfsQ-1 Received: by mail-wr1-f69.google.com with SMTP id v18-20020adfe2920000b029013bbfb19640so5411212wri.17 for ; Mon, 16 Aug 2021 05:20:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/l26ZOlW3xGU7zJl7RKCGpKoJ9rKEPFiPOxBz7+D6xk=; b=jKT7BMyMRD1ay5vK2z8AcjLn7PsBocnopZ+z/O+NLnj0iBplv9IFblpZ6mX2ZC+5nj bZ1+WEoRyxE6ncIzG9qFcXy/Lm66d/JIoXq7DMZmmARRP6bNpyCQ93A0k4OIokgSVxD8 1ju2xbuq3iKw16VY1XRE0exE1x9coVPiH+FXfardQEgR+EGCb+bBmvHOtrISsymTP8i7 QwXO/iAQQz21ItnG/fB4fpxzUtiaoWSIVtYRBklZqs+9aWzYMZAIHkCbl+P/L2/5MtTu loJlJ+TGwuJ3eAoMiKhW1mqXnmI397tx3LaxvHb7zDi/nH5ULCEIjF2yuaNnOjkV2EAr 4JrQ== X-Gm-Message-State: AOAM532rrNcjIk1lqlBvRppM9kvwOyz0pEFRNTrtTyp/qocTSLQt4izW 1AG7bc5Iv9mcOfjY9BS6OytLQil06VGS4ADlOO3ZYleaxCRpYek/URQdjBzcefu5B5KRx12OfCk WJUtfbWfkAqA= X-Received: by 2002:a5d:4983:: with SMTP id r3mr17992487wrq.232.1629116444414; Mon, 16 Aug 2021 05:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/A82vJRDUN2J0t1gWu8dYooJs99PDmbnNeV4RnsWYfwphmQuGFBHHk8sglXZmPztjmylbfw== X-Received: by 2002:a5d:4983:: with SMTP id r3mr17992467wrq.232.1629116444210; Mon, 16 Aug 2021 05:20:44 -0700 (PDT) Received: from [192.168.3.132] (p5b0c67f1.dip0.t-ipconnect.de. [91.12.103.241]) by smtp.gmail.com with ESMTPSA id g12sm7293158wru.85.2021.08.16.05.20.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Aug 2021 05:20:43 -0700 (PDT) To: Matthew Wilcox 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)" References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC Message-ID: Date: Mon, 16 Aug 2021 14:20:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 85B2F5007E8B Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KMFX3Frb; spf=none (imf04.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Stat-Signature: trxiby8annju4qz36gpwdst58nhi1wtb X-HE-Tag: 1629116447-679216 Content-Transfer-Encoding: quoted-printable 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 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 b= etween >> processes and consequently different MMs? That sounds like a very bad = idea. >=20 > 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? >=20 > There's a reason hugetlbfs was enhanced to allow this page table sharin= g. > 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?=20 Who cleans up the page tables? What happens during munmap? How does the=20 rmap even work? How to we actually synchronize page table walkers? See how hugetlbfs just doesn't raise these problems because we are=20 sharing pages and not page tables? TBH, I quite dislike just thinking about sharing page tables between=20 processes. >=20 > Think of it like partial threading. You get to share some parts, but n= ot > 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=20 special use cases. I know, I'm probably wrong. :) --=20 Thanks, David / dhildenb