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 E888FC4338F for ; Mon, 16 Aug 2021 13:58:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8AC2563302 for ; Mon, 16 Aug 2021 13:58:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8AC2563302 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 2D11F6B0073; Mon, 16 Aug 2021 09:58:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25A708D0001; Mon, 16 Aug 2021 09:58:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FBAE6B0075; Mon, 16 Aug 2021 09:58:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id E7F2F6B0073 for ; Mon, 16 Aug 2021 09:58:21 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 910AC18107760 for ; Mon, 16 Aug 2021 13:58:21 +0000 (UTC) X-FDA: 78481098402.26.A007E40 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 2482A5007E85 for ; Mon, 16 Aug 2021 13:58:21 +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=6q1+UdtYiO8s6rj0/c/nQ3ECy5RSEzhQllvM+6vQdJ8=; b=cQ2mlhP60SgjrOH7VyYtCbZ6xq BElSBir7HnhCbahWGm9ukBCQ1FrwUhWmD3PhURPAtDmJZYoNuANE+GX3rfZQoZ2sNi6yBjV2gBwIH 86aCmG4mhqhk9y/NXlAf9QjNMYjhzUrBWu5dnINkMZUkRlQ+EwbfMRsBvviiZAAiBXY4R3GGqmX1q BVhZs0/rkDTmxDgn34gPwIs7NG5YAxxN/CZ4v5yNcRpYMEPDIuM5KDgQxrkIKav0+K1H/DCSoEcU8 1skTS2TpbEuLWokUS0rWhiM/SAixCyjNIhe31z/Lm2o4HRrN/vR7Ha4uFeEapzRwt0198hV7Ka/Nk +f1oEBYw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFciu-001PhE-KG; Mon, 16 Aug 2021 13:32:41 +0000 Date: Mon, 16 Aug 2021 14:32:16 +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: <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> <88884f55-4991-11a9-d330-5d1ed9d5e688@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <88884f55-4991-11a9-d330-5d1ed9d5e688@redhat.com> X-Rspamd-Queue-Id: 2482A5007E85 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cQ2mlhP6; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam04 X-Stat-Signature: ey7p5zyazht4s8hr71g55tcpqyctst7e X-HE-Tag: 1629122301-540860 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 03:24:38PM +0200, David Hildenbrand wrote: > On 16.08.21 14:46, Matthew Wilcox wrote: > > 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. > > I read that somewhere else before, yet we have heavy 1 GiB page users, > especially in the context of VMs and DPDK. I wonder if those users actually benchmarked. Or whether the memory savings worked out so well for them that the loss of TLB performance didn't matter. > So, it only works for hugetlbfs in case uffd is not in place (-> no > per-process data in the page table) and we have an actual shared mappings. > When unsharing, we zap the PUD entry, which will result in allocating a > per-process page table on next fault. I think uffd was a huge mistake. It should have been a filesystem instead of a hack on the side of anonymous memory. > I will rephrase my previous statement "hugetlbfs just doesn't raise these > problems because we are special casing it all over the place already". For > example, not allowing to swap such pages. Disallowing MADV_DONTNEED. Special > hugetlbfs locking. Sure, that's why I want to drag this feature out of "oh this is a hugetlb special case" and into "this is something Linux supports".