From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3BFB4359F85 for ; Tue, 16 Dec 2025 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765899364; cv=none; b=F57UK0+4Eycwzp6AF8DHIVtIaxNaq5OFhjRRMItMUmKXsm0Lf8URnyOtsZCyovrgMq3X3M7YifuS4tbmUVbaYgY5dLEjXESDZ321J1w06VmQyZpdllHFD1pPWpXwW0UK+y2YPZC/migE6qk2C4/9mJRXRg8ucgr1etJf0JD+qHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765899364; c=relaxed/simple; bh=O0oht0stMXIUBV9lj1JNb7Bk6/vRFEGMKaCPVqMgno4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OtTM5UrSo2cCfdnVc6/PnnkQhTPUpoDRmrvOczWBrR0w8Ff0KhR3Ho69g3qsfoSa9EjeSIQAZwTqkaVF7/mzPNc/CpKBloNw5I9vIG0sV1+oE8WZB8WTYZe968bT366jzvL6jTa8gUUnVUO0zYqt/iRbjaWQ3par3aHCvMYTet0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pzD/yC5V; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pzD/yC5V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47028C4CEF1; Tue, 16 Dec 2025 15:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765899363; bh=O0oht0stMXIUBV9lj1JNb7Bk6/vRFEGMKaCPVqMgno4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pzD/yC5V06GL/gi/zSEsCqkmY3Y4oEQ6OShviD1xaXAEauxdOtcBtiVh3VGHvUbWt 9woS/D2Jjooo2Otnph7AbpxqS4W/1dwFu+9f36Q0Y6X2Nwl4xA2I9qeP04oX+L6Xmm yeB0XxIhIP/9Wl5GDGVkK5Pbh2o0u/HTZbJgs3PNGjCzDC8b+JAxqDbtOLqYXUXho/ XWh2UQstnxn/NY4YwcT0av4W0nRgGdNiVDzwjU1Xn8urJhv17/wyqJbuCGEpLtdv1w rijy1a6z6FwQAmg2vRWMRXD0tvHg8WcQsLHQ4e90/L3QjQSkN0k56cKn1YxdoFrZ5c rqPzeoC7zznxA== Date: Tue, 16 Dec 2025 08:36:02 -0700 From: Tycho Andersen To: Mateusz Guzik Cc: Oleg Nesterov , Christian Brauner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] pid: remove unnecessary idr_preload() Message-ID: References: <20251215201514.1343231-1-tycho@kernel.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 16, 2025 at 11:02:33AM +0100, Mateusz Guzik wrote: > On Tue, Dec 16, 2025 at 10:44 AM Oleg Nesterov wrote: > > > > On 12/15, Tycho Andersen wrote: > > > > > > From: "Tycho Andersen (AMD)" > > > > > > As near as I can tell, nothing in the second pidmap_lock critical section > > > actually allocates an id, so there is no need to do idr_preload(). > > > idr_replace() does not, nor does pidfs_add_pid(). > > > > Yes. The extra idr_preload() was needed for pidfs_add_pid() after the commit > > 9698d5a483654 ("pidfs: rework inode number allocation"). > > > > But please see > > [PATCH v3 2/2] pid: only take pidmap_lock once on alloc > > https://lore.kernel.org/all/20251206131955.780557-3-mjguzik@gmail.com/ > > > > This patch removes the unnecessary idr_preload() too. > > > > The patch can be trivially rebased on top of this one (actual rebase > would be cumbersome; instead one can cp kernel/fork.c > kernel/fork.c-tmp, apply this patch on top of stock file, mv > kernel/fork.c-tmp kernel/fork.c and commit resulting diff). > > However, unless someone is looking to put this into stable branches or > similar, I think the dance can be skipped at no loss for future > generations. Yeah, agreed. I think let's just take yours. I'll test it now. Tycho