Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3460253imc; Wed, 13 Mar 2019 19:39:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcaI73HF3u4eK/tTPhW7IrqWfQdLuT0bRmCc1xo2jD4iQtAEpYQhi8bvgRy8eav7NsGPrt X-Received: by 2002:a65:6112:: with SMTP id z18mr33869453pgu.272.1552531192511; Wed, 13 Mar 2019 19:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552531192; cv=none; d=google.com; s=arc-20160816; b=r2cquoJc6SjWH0JqmBJcOrpnIz/+ySuoYQMMiyepSYSuLY9COnbezBqzm37g6Q2AUz p8zg4qFDgTUQhPOSpFYBrjXPaAISGW3TYt/WJGO2/Z8X76rIou+4uNi1egwHyGeyq71v E1VMV5n4pkKTd5ExPUegzp+3Igvy0pfaBmQ9JHugPdxrN/MlDFR9rdnVU80NZIRDx9/L 65bZvLlEOwXJWtuVE8CvgdNXBOSoHx8bXpKGWsZABf1qI5MoKRfNsYybR0XGjSJxV7vZ YoWSHwNMDTu+nho1NIrdeNmZqlVYR/1WG96NpPP8UmN+wURO0t4fmlJU7cRYD+YgBra+ WetQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:dkim-signature; bh=WrV/l3y03S7xRIJhtjzGGZQ2l0CIcACK9FVzXe701Bc=; b=bNcfUPU/e8+w9/6Cl83p1recjDjPwn6EKM43mlSxF3e2GNDI4727+K3xb0ybOVV5L9 RCCs7lPeUpbxtq8mUA6MmUanpsJDpUovADJEyrxl/IoXMTyfWq1/7p0nDtyIOPaKZQ+8 04rsHT2OUiReJx9B2i7mEhNg4KB8m9cQF+BGdGmSTt1JuDa6d3EqMWBQkSAJSyJyTHCe cgpK/BgNSwX/6p9IkmphhOcKt2jTe2zIcS8AO3aFWPIerGvxm9PUi09zyUg/mhIP/qpO RQg+V2rtc6QwTeYcdQ8lr6eL/kbDj1Xa83Akl+QdyWOsR9Zq2CCqF55/jIUHAP9sm6uu dpZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=obDt0O3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si12417640pla.112.2019.03.13.19.39.36; Wed, 13 Mar 2019 19:39:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=obDt0O3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbfCNCjM (ORCPT + 99 others); Wed, 13 Mar 2019 22:39:12 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43278 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfCNCjM (ORCPT ); Wed, 13 Mar 2019 22:39:12 -0400 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:To:From:Date:Sender:Reply-To:Cc: 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=WrV/l3y03S7xRIJhtjzGGZQ2l0CIcACK9FVzXe701Bc=; b=obDt0O3TpgUPyGNDmJ9iJqqEB Ssi+k202lcjhiehZWxX6ofSRKAMJy7HQVlD1/2RP5fR7Q7CL/TD1bvRuRyq7rczg1chAeFMJNxAlp bv4J67NCThJ58mI6SQex2asFuz54u3NkLQuRvk6UC55pgP440mcY4M6CTPnBvby6v4fYMaVHg9nX4 jHgIfYuc6REF//krysmYpyhtl1KElDNpxNnQdoPg9rQrDALsOqKD67dlLYZeQ325LsaGp2kuLjYEk ewCWLYjdGa9bFQ7kbQiy+0UDBlnUTflaAyZ6kSby8rTsWBqu0ezgj1XEPVdQdD434VA8aO/UInC3o hCCzu11Tg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4GH0-0000H1-AO; Thu, 14 Mar 2019 02:39:10 +0000 Date: Wed, 13 Mar 2019 19:39:10 -0700 From: Matthew Wilcox To: Laurent Dufour , lsf-pc@lists.linux-foundation.org, Linux-MM , linux-kernel@vger.kernel.org Subject: Re: [LSF/MM TOPIC] Using XArray to manage the VMA Message-ID: <20190314023910.GL19508@bombadil.infradead.org> References: <7da20892-f92a-68d8-4804-c72c1cb0d090@linux.ibm.com> <20190313210603.fguuxu3otj5epk3q@linux-r8p5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313210603.fguuxu3otj5epk3q@linux-r8p5> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 13, 2019 at 02:06:03PM -0700, Davidlohr Bueso wrote: > On Wed, 13 Mar 2019, Laurent Dufour wrote: > > If this is not too late and if there is still place available, I would > > like to attend the MM track and propose a topic about using the XArray > > to replace the VMA's RB tree and list. > > > > Using the XArray in place of the VMA's tree and list seems to be a first > > step to the long way of removing/replacing the mmap_sem. > > So threaded (not as in threads of execution) rbtrees are another > alternative to deal with the two data structure approach we currently > have. Having O(1) rb_prev/next() calls allows us to basically get rid of > the vma list at the cost of an extra check for each node we visit on > the way down when inserting. It's probably worth listing the advantages of the Maple Tree over the rbtree. - Shallower tree. A 1000-entry rbtree is 10 levels deep. A 1000-entry Maple Tree is 5 levels deep (I did a more detailed analysis in an earlier email thread with Laurent and I can present it if needed). - O(1) prev/next - Lookups under the RCU lock There're some second-order effects too; by using externally allocated nodes, we avoid disturbing other VMAs when inserting/deleting, and we avoid bouncing cachelines around (eg the VMA which happens to end up at the head of the tree is accessed by every lookup in the tree because it's on the way to every other node).