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 B1E8E1F5842 for ; Sun, 23 Nov 2025 15:00:34 +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=1763910038; cv=none; b=VbaSFKomhRrSgXRC/RCPSVhmCs4heu8qqc3qrCWRXsCyspfyhPm7e7sOslDBiwY/PXIsX6F264duR1anCIfjAmklVgufNbs1hJQkIR6yT/QcbGauswkxMcVuQua+bOAYLmXTREwF6jNDF2ZdjHA+JglNJ68eTvh/8SUKE8k9M6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763910038; c=relaxed/simple; bh=T0LcUGo7ppjHTuyN+uxvVerqW7SdjV6XGCvERR+o1Zs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BT90yvZgA7jIlAFXhztyXakxaZpv/qHkDEcZRWjhE7w2X2sQiVxxXuvDwuY7NaJql/cI7g5ZcNmJ0WVRhVXmKHRaum7FG9hbtNRlDarsjGBPl1QvIELJZs1ZSqrOyviJyiIUTN3r0x+8orCFlDDJn1Q5l7Q72xBjOhQ/8O/NyfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=nXR2QW3s; 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=none 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="nXR2QW3s" 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=vPzOgo4wSLye7hvf6YZUBRjo/5vEsuGzogDqs/fKbqI=; b=nXR2QW3sDHw+B2LZ8F8viG138u 0L8ihS3bQBKbQOxJ3ryPGk7sKYNEQNvWa+F9g44RaQa1OnPPQM2ahtmAfnjF/sGxZu6l9eYU5OVou k9bfETdHu0fmudYKb0DwT8sfK51WqjoQoE5tfDgDRjat/uDdIKyefd4mhrDw/aKUWn8Kp9ei0g+zQ Jkr+whQxrInGOUbzXn2tjr64rdbCnUNwI73IgA25z2Z1MY1rHDW5+o1NBMEFJ3tXQlQbdRvBuylsq tsfH0BRzvt/fKxN7cXR7TOV6MdveU9lFiMI52Ti4YcV6QPNBas6/ZajbC3jq9R7zCE8UJKZhEX/LV tv6fUWTQ==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vNBZn-00000005hD1-2tpo; Sun, 23 Nov 2025 15:00:31 +0000 Date: Sun, 23 Nov 2025 15:00:31 +0000 From: Matthew Wilcox To: Mateusz Guzik Cc: oleg@redhat.com, brauner@kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH 0/3] further damage-control lack of clone scalability Message-ID: References: <20251123063054.3502938-1-mjguzik@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20251123063054.3502938-1-mjguzik@gmail.com> On Sun, Nov 23, 2025 at 07:30:51AM +0100, Mateusz Guzik wrote: > When spawning and killing threads in separate processes in parallel the > primary bottleneck on the stock kernel is pidmap_lock, largely because > of a back-to-back acquire in the common case. > > Benchmark code at the end. > > With this patchset alloc_pid() only takes the lock once and consequently > alleviates the problem. While scalability improves, the lock remains the > primary bottleneck by a large margin. > > I believe idr is a poor choice for the task at hand to begin with, but > sorting out that out beyond the scope of this patchset. At the same time > any replacement would be best evaluated against a state where the > above relock problem is fixed. Good news! The IDR is deprecated. Bad news! I'm not 100% sure that the XArray is quite appropriate for this usecase. I am opposed to introducing more IDR APIs. Have you looked at converting to the XArray? Or do you have a better data structure in mind than the XArray?