From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9EBF3D45CB; Tue, 16 Jun 2026 18:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781633297; cv=none; b=Vg0cyOjihnLq94xMIxPB4qVwobkhlpgEPib88O0XYZNr7uEZjSlnjyQpG6jc8/63r1HySuyO4hDkgpCAe2llWei25hOGK3jtnDzFvwQ8etBuGNUpYr19gFDI+cXJCLLS/x4xAu2KfhUbBzLaQLYeqMXji74RHB7Em/5EQU8h84c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781633297; c=relaxed/simple; bh=ZfH3JOgmf9XdcKWDOKQ+is9C8wTOGtm2ZIDba5Hcbeg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UvwHWxCqhF7a8s8q2EsDsiWx3OzAKWD8weUgMbVn7vrH/xn4oChPl/kGqOGI5iz5KM3xv0b3qQEOTT33xwxZNA20ykSF3a60DTgnb9d4mmjfd1KWnAlbvCFNYVMPr8RUrvOXRNQ/xf3h2aY2mMTmMa3oYcV9Eqdct3XsZHO3uXU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Tgw+agkf; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Tgw+agkf" 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=BCfXNXLBXAr5Arz1BeAs2uSx+MoF38R1sHrI4zD9Grw=; b=Tgw+agkf9gNlr8xaAP7VLpUzIn mt1q8YgGNxaT3kdLwwutfEOiVNWP8kfZl5jlDf/gbEwtfOk0/voLcLbyZ4c6+vlrbtaEWg3c9pJ47 TJAbjLdXZWaEYwwdJiNm7Hf2BMTC67SE/oQFHWawdwQuQ/tuP8551dSyKfgF97f3KHEGYa8+ur9v3 2qumHDZ3IyHB+cpsKf5VnypfQwsU9pFSAnHk88i+oJerth2ngfdZXq/EkhaKrnXLr9uotceyBKJM3 hdw5NTp4WubwiE38Aowitpr8cKTxGFQPnThPTi+4QU6OAaL9RDlK2LPUlwhOVr2ELXgK2WT8K9gSo 17584hAg==; Received: from willy by casper.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1wZYCb-0000000BFII-16Pg; Tue, 16 Jun 2026 18:07:57 +0000 Date: Tue, 16 Jun 2026 19:07:57 +0100 From: Matthew Wilcox To: Uladzislau Rezki Cc: Pranjal Arya , Andrew Morton , "Liam R. Howlett" , Alice Ryhl , Andrew Ballance , linux-arm-msm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Lorenzo Stoakes , Pranjal Shrivastava , Will Deacon , Suzuki K Poulose , Neil Armstrong , Mostafa Saleh , Balbir Singh , Suren Baghdasaryan , Marco Elver , Dmitry Vyukov , Alexander Potapenko , Shuah Khan , Dev Jain , Brendan Jackman , Puranjay Mohan , Santosh Shukla , Wyes Karny , Sudeep Holla Subject: Re: [PATCH RFC 00/12] mm/vmalloc: migrate vmap_area indexing from rb-tree to maple-tree Message-ID: References: <20260613-vmalloc_maple-v1-0-0aa740bb944b@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jun 15, 2026 at 11:52:22AM +0200, Uladzislau Rezki wrote: > On Sun, Jun 14, 2026 at 12:15:28AM +0100, Matthew Wilcox wrote: > > What I don't understand is why you maintain a separate "free" tree. > > It should not be necessary any more, but maybe you tried removing it > > already and found a performance problem? > > We maintain it in order to split several entities. That prevents > interfering between allocated data and vmap-free-space manager. > So in that case one context can easily access allocated data, for > example vread iterator, etc., whereas another can do an allocation. > > So by splitting parts i minimize lock-contention. Sure, but there are many ways to reduce lock contention. One is to not take locks at all; the maple tree is RCU-safe, so you can read the tree holding only the RCU read lock, as long as you obey the RCU rules. Specifically: - Write side has to RCU-free the objects that are stored in the tree - Read side has to trylock the objects it finds (and retry the walk if the trylock fails) - Read side can see a mixture of objects if the tree is changed while it is reading, but for any given index in the tree it is guaranteed to see one of the objects which has been referred to by that index. That is, if the write side overwrites an index that referred to object A with object B, the reader will see either object A or B. It will not see NULL and it will not see any other object. - If the write side stores both object C and object D in the tree, the read side may see neither, both, only C or only D.