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.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 9AB9AC2D0CA 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 BDAB72467F for ; Fri, 13 Dec 2019 21:11:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="KUXWoP7A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDAB72467F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 153168E0011; Fri, 13 Dec 2019 13:06:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 103C98E0001; Fri, 13 Dec 2019 13:06:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 019598E0011; Fri, 13 Dec 2019 13:06:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id DF6558E0001 for ; Fri, 13 Dec 2019 13:06:30 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 869C9824999B for ; Fri, 13 Dec 2019 18:06:30 +0000 (UTC) X-FDA: 76260898140.27.space11_38c6674db761e X-HE-Tag: space11_38c6674db761e X-Filterd-Recvd-Size: 4804 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Dec 2019 18:06:30 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id e10so79289ljj.6 for ; Fri, 13 Dec 2019 10:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZRQAIrIl+hbGowbZGNsh9Ab73IFpIkVICl8mdWlhZ8Y=; b=KUXWoP7ArAV2ChAKvPj2TXgnr0JqG8m1wqJu0mojiy8gYaqrARHP+wYUo1ZY6pUhi9 oAVU5vE0m8fQg77NUf1v/MAbeC3/wl7h7bDEXA/jO6LCeW8csHh4QBGXnrAdG8B5Guwb pvbiMG7KwGBZPcRnHB3UAGb1gXIAzMVC8tKbb5mdrzRVqn+c8FZoqtTil4MW0E8Snyx5 orPKB+JWSpXlgA5PC82ToTFE2bafU1bfwpESSLJUVF6ebaiuniMPVSOZBsvYkHtw3pcK k5rS6mHl9b6IJjolOKB5TQ2M7y1zzC6QcYbV6T8ygEP0306lqh+OKukoMnjEXIL+YtR2 m/9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZRQAIrIl+hbGowbZGNsh9Ab73IFpIkVICl8mdWlhZ8Y=; b=QHjQz05zEoPLG3xY8NwxbYezXGI+pv2zUbrOQ8qCJ1JYIR+xtUQ9FBEL5k8NVVOZ0c w5dtlxH+uYIvfaa69cs+hu5w8Uqny79c1BqnsHbpiGuPtP7bSD8Z4+g2Bu6dknYswWmV 9xFHPed0OrsPiWSGFewaV4orxOluf3zRRIR4M5msl4W06dYDLDiGmcLKV1fzFUVjYbjL ExygScUao9G0BKO05YQFTEH4B3ntFXTiY2LNGNiU5rPqaTPuDEbr5ykdCjd7vJqi6cP6 45wyp7gUYVGm+iQTS12s6KCTrSizxIGNiQzH8CoJA4bKBRnf9SwPYy54zVb7l7l6F/Cn 70LQ== X-Gm-Message-State: APjAAAXyKRfX4IVAVdktuPlG+F5oCQ7c2ZIhR+XamQDRFztc7AM8zr0S ID9/ltAG0tW3J8eYm31aJqiG7w== X-Google-Smtp-Source: APXvYqyM0Qwpzc8cUTF+W8ijIssbQSxR0ZLbrLzjaNPlwzbjPax4fpRoMacypUYXO2jy7YLgIomiYg== X-Received: by 2002:a2e:850f:: with SMTP id j15mr10442136lji.91.1576260388384; Fri, 13 Dec 2019 10:06:28 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id q10sm5231356ljj.60.2019.12.13.10.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2019 10:06:26 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 6AA3A1011E3; Fri, 13 Dec 2019 21:06:26 +0300 (+03) Date: Fri, 13 Dec 2019 21:06:26 +0300 From: "Kirill A. Shutemov" To: Matthew Wilcox Cc: linux-mm@kvack.org Subject: Re: Splitting the mmap_sem Message-ID: <20191213180626.aj5rper5kpjotbwi@box> References: <20191203222147.GV20752@bombadil.infradead.org> <20191212142457.zqp4mawjz7frpyvk@box> <20191212154002.GR32169@bombadil.infradead.org> <20191212154613.qrfsqrgb24sj6fcx@box> <20191213143333.GW32169@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191213143333.GW32169@bombadil.infradead.org> User-Agent: NeoMutt/20180716 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 Fri, Dec 13, 2019 at 06:33:33AM -0800, Matthew Wilcox wrote: > 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. I may work. But I'm not sure how it will work with remote mm accesses. Like with /proc/ interfaces or ptrace. -- Kirill A. Shutemov