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=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 9CE56C4338F for ; Mon, 16 Aug 2021 12:42:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F4FA61BE1 for ; Mon, 16 Aug 2021 12:42:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F4FA61BE1 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 AA00F6B0073; Mon, 16 Aug 2021 08:42:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A50316B0074; Mon, 16 Aug 2021 08:42:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9186F6B0075; Mon, 16 Aug 2021 08:42:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 74F3B6B0073 for ; Mon, 16 Aug 2021 08:42:31 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 03CFB8249980 for ; Mon, 16 Aug 2021 12:42:31 +0000 (UTC) X-FDA: 78480907302.38.A649452 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id A3AE2E00BAAA for ; Mon, 16 Aug 2021 12:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629117750; 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=+gBv/Q8Q/QcULcj4Fd/NoN5uynO5Hm+7XVaOKGJhj8w=; b=Q2gEen3dCXqfh2l+FsT7vFyB9litNe9k2jIdKt6jNeqhIxrP9nENYyCG94v5hK/TLXAg+4 O9ZBjPZt/frjTE9a84OFDfdrovVeFvHZGk7vgzNwo0Rsw1pfEiRcYQLNr3s3Ssof+oZgKB HHGlWPJzLuodsZgww2faoEW3AxQ4k4I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-kbIsQ552NauBXiY8Yol6sQ-1; Mon, 16 Aug 2021 08:42:26 -0400 X-MC-Unique: kbIsQ552NauBXiY8Yol6sQ-1 Received: by mail-wm1-f69.google.com with SMTP id m13-20020a7bcf2d000000b002e6cd9941a9so3612470wmg.1 for ; Mon, 16 Aug 2021 05:42:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=+gBv/Q8Q/QcULcj4Fd/NoN5uynO5Hm+7XVaOKGJhj8w=; b=TLSvWNVLOobB25hAdLYi8kZV7xXZwhU4gUZU5c4Q2aF0spjFyqpQJgT77KHBMl5+Up hhWjYWCARR8BcbCeVx7uZeGgesuD5DLnkzxs32s+KQwYoXNV5Ufv02sCkrPmBgoxyxQb NDdJUvjSEoKUyU2VtC0tsOqFPiLGOyOeSyVSNwL7N65sqi//3W0MEvgoRxsel9BOEcP/ wRJiP8vEdP3TXEvV2McOej8nwsiDvGBohn1VG9bkkl0FMJR1WnAKTfuPIuXHWQdfr1uM mQzRbTZldk/aSj/TnfYyZ7VzneyF9ytBWWjeMehN+wk04DYOhYD/cBORz29QEZa4WrE4 GElA== X-Gm-Message-State: AOAM532HJhn2AzrdcZLT/CSPB8lkjRQ+Np9dMWrGxvLmutFCNY+b2IZT qg3Jp1NeN/BjAmM8L4MP2pPhcYrThf/RnuvSCsDC6/4aLdNUCnDxBLEHWvOv3cMBiBlhb7uX74Y cli1dTPX3cPA= X-Received: by 2002:a7b:c2f0:: with SMTP id e16mr15153400wmk.144.1629117745523; Mon, 16 Aug 2021 05:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5WHvk1HuKVYAo9iZE9tGW9zzdilQKuTMoH0v+h7IZddDmuuTDSgukHZKbwBsTEVhiDvnRNQ== X-Received: by 2002:a7b:c2f0:: with SMTP id e16mr15153391wmk.144.1629117745334; Mon, 16 Aug 2021 05:42:25 -0700 (PDT) Received: from [192.168.3.132] (p5b0c67f1.dip0.t-ipconnect.de. [91.12.103.241]) by smtp.gmail.com with ESMTPSA id 6sm10396357wmk.20.2021.08.16.05.42.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Aug 2021 05:42:24 -0700 (PDT) Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC From: David Hildenbrand 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> Organization: Red Hat Message-ID: Date: Mon, 16 Aug 2021 14:42:24 +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 Content-Transfer-Encoding: 7bit Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q2gEen3d; spf=none (imf30.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A3AE2E00BAAA X-Stat-Signature: ayx353iou4w797baxmxithfhp88nn46r X-HE-Tag: 1629117750-949936 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:20, 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? > >> >> 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? I found what you were referring to: CONFIG_ARCH_WANT_HUGE_PMD_SHARE I was not aware that we have such a monstrosity in the kernel. -- Thanks, David / dhildenb