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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CCE9C433F5 for ; Tue, 25 Jan 2022 14:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B4446B0073; Tue, 25 Jan 2022 09:10:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 962EC6B007B; Tue, 25 Jan 2022 09:10:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82AD76B007D; Tue, 25 Jan 2022 09:10:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 765236B0073 for ; Tue, 25 Jan 2022 09:10:15 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2AA42183E46FE for ; Tue, 25 Jan 2022 14:10:15 +0000 (UTC) X-FDA: 79068993990.29.B4BC3A8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 43BB42001F for ; Tue, 25 Jan 2022 14:10:14 +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=NDtxC4AV4/gW2KDw8MdrhdATAgU1HE8zgSQEUrvWdfA=; b=lVeE5N5gZ+s+tz3PNV9JEqvxsa EhDK73wXij4kY8XOew/ZcY/NaO1P06iTeSjOyS1JpZJMNJ3rBNpZ+s0v02RlldkEpU1nmYb6GDbTq I6HEaInAa3VmYijtrAd0ZUTAvrRlYrZHhFryAZ091cCRys/L5Ix8OMyo8PQzD362ye6JINFkZsbd1 Bn2pH841+i6OHOSrZzoCtQ3rnCt5dX9isNcYf1qATlO7K3Kg5Y0Qpox8mEox31cE09u8eCkKOwlS1 zcxfVR17ybd2Xbbk/jR3mSNPFs5+fJyUE5iNVggih+ndpTXHou7/oF6YOovBhJZkISGxTwYNZNFdJ f61cwj6w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCMW3-002urD-5S; Tue, 25 Jan 2022 14:09:47 +0000 Date: Tue, 25 Jan 2022 14:09:47 +0000 From: Matthew Wilcox To: "Kirill A. Shutemov" Cc: Khalid Aziz , akpm@linux-foundation.org, longpeng2@huawei.com, arnd@arndb.de, dave.hansen@linux.intel.com, david@redhat.com, rppt@kernel.org, surenb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 0/6] Add support for shared PTEs across processes Message-ID: References: <20220125114212.ks2qtncaahi6foan@box.shutemov.name> <20220125135917.ezi6itozrchsdcxg@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220125135917.ezi6itozrchsdcxg@box.shutemov.name> X-Stat-Signature: p8j3pcbiju8ybmuggjgpgp9zuqt936jd X-Rspam-User: nil Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=lVeE5N5g; spf=none (imf13.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-Rspamd-Queue-Id: 43BB42001F X-HE-Tag: 1643119814-659636 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 Tue, Jan 25, 2022 at 04:59:17PM +0300, Kirill A. Shutemov wrote: > On Tue, Jan 25, 2022 at 01:23:21PM +0000, Matthew Wilcox wrote: > > On Tue, Jan 25, 2022 at 02:42:12PM +0300, Kirill A. Shutemov wrote: > > > I wounder if we can get away with zero-API here: we can transparently > > > create/use shared page tables for any inode on mmap(MAP_SHARED) as long as > > > size and alignment is sutiable. Page tables will be linked to the inode > > > and will be freed when the last of such mapping will go away. I don't see > > > a need in new syscalls of flags to existing one. > > > > That's how HugeTLBfs works today, right? Would you want that mechanism > > hoisted into the real MM? Because my plan was the opposite -- remove it > > from the shadow MM once mshare() is established. > > I hate HugeTLBfs because it is a special place with own rules. mshare() as > it proposed creates a new special place. I don't like this. No new special place. I suppose the only thing it creates that's "new" is an MM without any threads of its own. And from the MM point of view, that's not a new thing at all because the MM simply doesn't care how many threads share an MM. > It's better to find a way to integrate the feature natively into core-mm > and make as much users as possible to benefit from it. That's what mshare is trying to do! > I think zero-API approach (plus madvise() hints to tweak it) is worth > considering. I think the zero-API approach actually misses out on a lot of possibilities that the mshare() approach offers. For example, mshare() allows you to mmap() many small files in the shared region -- you can't do that with zeroAPI.