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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 9B199C2D0CC for ; Fri, 13 Dec 2019 21:11:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C7DAB24695 for ; Fri, 13 Dec 2019 21:11:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JmMMH8Rl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7DAB24695 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 105AB8E0007; Fri, 13 Dec 2019 09:33:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B5C18E0001; Fri, 13 Dec 2019 09:33:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0DE68E0007; Fri, 13 Dec 2019 09:33:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DBD5C8E0001 for ; Fri, 13 Dec 2019 09:33:38 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id D6E6B8249980 for ; Fri, 13 Dec 2019 14:33:37 +0000 (UTC) X-FDA: 76260361674.14.land32_59d12fc74a50b X-HE-Tag: land32_59d12fc74a50b X-Filterd-Recvd-Size: 3202 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Dec 2019 14:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0pYHO9hQqp6RKuHaapmzlT1hWHJKW+SBqq7iB0Gl4og=; b=JmMMH8Rl/4pDqkpeBn+7G3muW YabuMxPS6LAS2eTbfGAn+7qXXTP7zW9mr6UmBygnMq432rMvLx7YUKBB49ge356+3NfOxkl+n7K0o 6FNQISaY9Vc9Eh8SwquQh3vbBXYZ7wqrIRfr7Vj908kG65hA73EIIXR+qyVgvpldLOhkv4w4yemUH 5EWrmxSZJ15WNU/x0gZmUhlx0JE9HWDkFNRo90jTM90j4aTD6D31/rpe5DvcrBm1zWLaEsVE+/BAA WrgkSahp3BH8RMa0Nm+tmHbEk1c6ayyzLu7qSWxqkH4YIPrThtn4wGT/U//zsokWHxCnxRS43ed7F GFgus2SKQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ifm0b-0000gU-Md; Fri, 13 Dec 2019 14:33:33 +0000 Date: Fri, 13 Dec 2019 06:33:33 -0800 From: Matthew Wilcox To: "Kirill A. Shutemov" Cc: linux-mm@kvack.org Subject: Re: Splitting the mmap_sem Message-ID: <20191213143333.GW32169@bombadil.infradead.org> References: <20191203222147.GV20752@bombadil.infradead.org> <20191212142457.zqp4mawjz7frpyvk@box> <20191212154002.GR32169@bombadil.infradead.org> <20191212154613.qrfsqrgb24sj6fcx@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191212154613.qrfsqrgb24sj6fcx@box> User-Agent: Mutt/1.12.1 (2019-06-15) 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 Thu, Dec 12, 2019 at 06:46:13PM +0300, Kirill A. Shutemov wrote: > On Thu, Dec 12, 2019 at 07:40:02AM -0800, Matthew Wilcox wrote: > > On Thu, Dec 12, 2019 at 05:24:57PM +0300, Kirill A. Shutemov wrote: > > > On Tue, Dec 03, 2019 at 02:21:47PM -0800, Matthew Wilcox wrote: > > > > My preferred solution to the mmap_sem scalability problem is to allow > > > > VMAs to be looked up under the RCU read lock then take a per-VMA lock. > > > > I've been focusing on the first half of this problem (looking up VMAs > > > > in an RCU-safe data structure) and ignoring the second half (taking a > > > > lock while holding the RCU lock). > > > > > > Do you see this approach to be regression-free for uncontended case? > > > I doubt it will not cause regressions for signle-threaded applications... > > > > Which part of the approach do you think will cause a regression? The > > maple tree is quicker to traverse than the rbtree (in our simulations). > > Incrementing a refcount on a VMA is surely no slower than acquiring an > > uncontended rwsem for read. mmap() and munmap() will get slower, but is > > that a problem? > > Yes, it does. Especially for short-living processes. See kernel build as a > workload. Ah. Well, we can skip the synchronize_rcu() step if the mm_struct has zero or one mm_users. That should avoid a slowdown for mmap/munmap.