From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 BCD093EC2D1 for ; Fri, 26 Jun 2026 10:18:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782469109; cv=none; b=BF9RswJpLtBvwT0BfV/MCGBQ3/ogxTAF+J4jASP64WmogmaZshNhpU3aBJ87/R+T5YrdKrIoPHFojlvZdcJMhBHp/LYNosdYcssHpXocVAAOPqsPpRDiJWPVLT1k1TLL5Y8LgU68AnQQxAOUKNBsuw7tG0VVWUD4UclrKUma30g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782469109; c=relaxed/simple; bh=iV8sbR8qXEcTRdqyTnJTFgH8LTtiTcASYzbXJuopBvg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=phYm6HVkXMQ7JBNK3AgJPxn96FVY8xkDfs+mhK4twySv8Ig65vrlM5juCHTMu35FmBhQODHGleWqX07PayzgQur80ijBJZ4zJekfwu/e5FVvZr74NimmLnC6Fqfv1Fe1CJmrNlSV2GRYZItkcdMmpmxlKfzIK5PLdxBZIOe7v0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=koEB/bCN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=T75dWAEQ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="koEB/bCN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="T75dWAEQ" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65Q9xkMO771963 for ; Fri, 26 Jun 2026 10:18:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= tIfc2dW5D9lK3/GVNNe/Fcf9TU8SCV3bTMPzuN/zFww=; b=koEB/bCN9dHGYL+f 0r/RdoyBw0jGZdj0v8eGHDlxiXnSa1v8ga4jGjcP59J5XlmdvP05FvieAcM6Pc7d ytZSPRBjm5rls5FAjru0hw11vkvfJdH8B7awrc6klgjm4dHXfeQmhPWtthtmarK9 eZfmpkzJWzATEcShiaCE9QrLG9Q56O0qZvrr3Xhe+6bLhHFDBvUnf9O24NIOzXJM 9ii6P4gC8uAscYbPm7M0QolduDZnueodaIRnF9hiVTfXX6pM+HVCSs//LlBgXlk0 jm6K5UMocRt4B7sgXFrp1j1zQdF8sGh/9yUcsPFjgZKClmAJZa1kx2bpS++lk+n1 ltQL5w== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f1p2trbgp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 26 Jun 2026 10:18:24 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-30c0d568830so3646783eec.1 for ; Fri, 26 Jun 2026 03:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1782469103; x=1783073903; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tIfc2dW5D9lK3/GVNNe/Fcf9TU8SCV3bTMPzuN/zFww=; b=T75dWAEQz9ILJIQ8Trjffa1PxNqtaFpZRotZdjOjVsttwj4WBpstPuMiV3GIzkIbTs A7RkaPjW5V4DpcWOvNTsWkjWJJvpnYAyaLBaVd/mDPazfS7HfkEjej0u/cTo/EtKAszT Hk7SWXCC6Pp+Frabiofa1W7VtbMUNJuGLL7z7ifk3kKw4aCspb338zv6XWyHi+gMzdxX ky5hzAXvGpouz5frjCwpRpba9TZB15keoRtbyFatIpPuRvRXbSjat9Rz/wo1fsRFRkd6 O7WbrVCo9+W/s5BcVTG/Coz7SwSKtQXjINA4dL18WdGcTSnKsuKy8HOn9LnBq14tIHgp HZFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782469103; x=1783073903; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tIfc2dW5D9lK3/GVNNe/Fcf9TU8SCV3bTMPzuN/zFww=; b=fcd29M7xVlif/+OZo20lvtoKSvt20Ymjl4sfT9LMsJVzkDgXXcRNAYpBEAbYXFDeUy qGx31pa/VhNCo8UWFqXecxsrrO1PHof2IP4+zdrhiLOLo4ewcZMR6WJWR3BLbazI8Ekd pODgZYfFXywRir/hcBQW5PeqaocUTFEcPEPzElHDuADUweonXx7onbFZnLevfqGUiEzj b0om08836y2qsjvZxENvd0FHM2H1+ZLy6CK3dsq7Sqj7yWz5TVDYmYqyptjSwQ2VKPKy l6Jz1MI4LqBFKfc7oFOKo6KWbvG/xvxwEBK1nRxrHfVvECfqf/qijBdAo5+4ePFYRo7f wwmQ== X-Forwarded-Encrypted: i=1; AHgh+Rr47/WCGSVcaqs23syfbMfDCFZb3AViTyvuSKHRt9QgZIfFQtr8RKU7dUn9M0FUjo9OU2DxVfSuHS/ouw0=@vger.kernel.org X-Gm-Message-State: AOJu0YxUV3vi892lor5yrrxf31Kw/GA1tn0xbJXFzuChRuPWnjfhrSYk Nro7WZJL6eQBgOAoxGMyu1mAjBoL3U4/qd8j6zWNxgDKcfO7s+lGTkeiEncbF6FPXz9ANTRrE1Y L34IT4M+wk/LfB02tUJvcFjJJeQdXV4nEi2uVyhqpP209Q4AYpzYPu9XYYzF8D4zbe8g= X-Gm-Gg: AfdE7cljeYrkAybCT2dnYoR6ROJ77/5v5fbrvHRAjkScLNN+GDYgngKwM20eoJpfPj/ YT02mOBrNVW53RuxxLCZY5r0iJ2TXs6LdSzyXhvRn5RF716P6t5j0u+OxuV2OMkOHr55+Qj+L38 L7Mb5fwtnHs95fY8Q7HXMbAuvPwL/QJzqSxiVI6NWrl0Uy45IsxIAlohnUYKLhPMqs24WgjNl7p +H4BvUtu+ekdE8T3WtbAOw9/jJ27Sh22YMYv29kTO1so+HnImP/OFcjaidEw+EjQArV1JJ5vJ5r PrdCszcR51lABJA/LEJ9xpI7jdgGNHN/ps5OD9cUL3+6s/CKWGN+gxF/nvYNJXDrmvd7Jz0b+LJ uHHFpFCAybBIJNpXdDTVsEutcaHwKRtXCKd9VXCn1 X-Received: by 2002:a05:7301:9c95:b0:30b:9b64:4a3e with SMTP id 5a478bee46e88-30c84b6c547mr7176400eec.1.1782469103351; Fri, 26 Jun 2026 03:18:23 -0700 (PDT) X-Received: by 2002:a05:7301:9c95:b0:30b:9b64:4a3e with SMTP id 5a478bee46e88-30c84b6c547mr7176368eec.1.1782469102833; Fri, 26 Jun 2026 03:18:22 -0700 (PDT) Received: from [10.218.25.225] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30c7c4ca240sm17372659eec.4.2026.06.26.03.18.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2026 03:18:22 -0700 (PDT) Message-ID: <9eca8338-bfcc-4241-954f-2bf2fd14db1d@oss.qualcomm.com> Date: Fri, 26 Jun 2026 15:48:12 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 00/12] mm/vmalloc: migrate vmap_area indexing from rb-tree to maple-tree Content-Language: en-US To: Uladzislau Rezki , Matthew Wilcox Cc: 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 References: <20260613-vmalloc_maple-v1-0-0aa740bb944b@oss.qualcomm.com> From: Pranjal Arya In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNjI2MDA4MyBTYWx0ZWRfX/57wZnX2G01u c8vIDvEqlhXYCuIDC5dGMkKs6lq+Rr8JbkYEST8IOyr11dh/jK//OLUAJU2tqtYF+oq0voDpObo V9f+0+xrBOX3h9Nz9HOcBlU0XVdbvzg= X-Proofpoint-GUID: e8BBc-wK3YFQbxfR9RqLC7olsB8NCvnm X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjI2MDA4MyBTYWx0ZWRfX/zIo309J2yox +ot634prY5OZSa7PpJHMP7lIe4/kPtLjgFGNrVwYBGWChLDGCkK8rc0fxqZZWL87qv4PPdRAUWC VtaX1ufjyntboV1478zxWAxdVaCjq6pzjGVMCyr193nvwZ364zU2/2PlvZigSdwtsK5fkY22rtA PV0rPNXvhGEtC75wCCUS+zw2pU9mhOMD2fZa+dRyU6zW5lNipAcWzqWQUw1kaNaqkHQZOkbQfjN nLaYn4GU6rCNJa5iVCmZsQDoG9TJHJ6e+Rv2pAkXSwyCXkLA4EZY72vh72jjpJI1srxuj3sOor5 Vya0AU/muEbvHuDYESXHGfwye/6inRb+r+/a798oV2ZaJVmyWAlgE0i8UnkQDdaCbQESnuvjiqc 9PMbH0hpVUdfWc1wTQJNbf5SbcmSqpe3JUJqBAupKlPKKpsmtUqLH5Mtnk1I4vqoaLhPEtu6MEA 5lCJP+0Y0I7oxPpXKIQ== X-Proofpoint-ORIG-GUID: e8BBc-wK3YFQbxfR9RqLC7olsB8NCvnm X-Authority-Analysis: v=2.4 cv=IM8yzAvG c=1 sm=1 tr=0 ts=6a3e51f0 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=3FYh5rYaCfyF3NCrosEA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-26_03,2026-06-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606260083 On 6/15/2026 3:22 PM, Uladzislau Rezki wrote: > On Sun, Jun 14, 2026 at 12:15:28AM +0100, Matthew Wilcox wrote: >> On Sat, Jun 13, 2026 at 10:49:42PM +0530, Pranjal Arya wrote: >>> vmalloc's free/busy/lazy area tracking is one of the last remaining >>> augmented-rb_tree consumers in the core mm allocators. The rest of >>> mm/ has been gradually consolidating range-keyed indexing around >>> maple_tree (notably the per-process VMA tree in mm/mmap.c), and >>> the underlying reason is a structural mismatch between rb_tree and >>> range tracking: >> >> First, and most importantly, I love this. The maple tree is undoubtedly >> the right data structure to use for this purpose. >> >> 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. > > -- > Uladzislau Rezki The lock contention concern makes sense, and in the next patch I will incorporate the suggested changes. 1. find_vmap_area() will be converted to a fully lockless RCU walk. With MT_FLAGS_USE_RCU set on vn->busy.mt and call_rcu-deferred vmap_area free, callers such as vread_iter and vmalloc_info_show will traverse the occupied tree without taking vn->busy.lock. This will eliminate the contention. 2. The global allocator lock will serialise only the gap find & range publish pair on the occupied tree. Per node busy lock will be a separate, finer grained lock will only need to be held for the busy tree insert after an address gets selected. 3. As Matthew noted in his follow up, the maple tree's own RCU safe node retirement will need readers holding only rcu_read_lock() giving a consistent view of the tree at every index. So the contention reduction goal will be met without a separate free index. BR, Pranjal