From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 026A443DA55; Tue, 14 Jul 2026 09:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784022482; cv=none; b=aCr/7OmylAYzXkE59U6M0f08SI4x/fLtgsA+JQfZPH1OGiK63Ch602xR1SA0ivUkJosDbqOQONxjKDDMcTr8He7G6AcaS7WaUkh2OHWn+8Wb7CSaymMbUudmbiStIl7R0v/3qu7KnUqqS8RSYrIN7V+Py0E+svtHHmKrLMtQ5iY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784022482; c=relaxed/simple; bh=tAT4Z+WZSwzntwIe2Ep114LUICO74oUvIOFxwyfiux8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TLXqdF89CbZsRKXl3Y1/xrODCrA70eRK96SuBJN3JO3C8zjC8y8ucq4YxGgFjCPAGyfoiVMIoCC4nDe44UYOP4J+nY65V//ADUQoYv3aeVfmqVVW4oa2NLxpxpcKV+n8Prz2TquwSYqeH2sssQ6CO/zT8Tw4OPY8rS3amGc5U9c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2hWoWkG4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LP96mIHU; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2hWoWkG4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LP96mIHU" Date: Tue, 14 Jul 2026 11:47:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1784022474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bsoTcN4gOIUfOGf3p48bZzeZDJjL/YfjT1YTWmmpNPE=; b=2hWoWkG465yKctF00Mw9KQ6sYZmw5YgJznP4SIGc5ImYPXmIYeS6IbfXVTCZTHv/KI4E2U f8Bk6aFvBq49FugZVTn/t+nTwVk3uOjUb+xLzqQ1ylaI4YuaVeQfW1h09gVtK/zATFk1TZ KoCxwcqYpF9YJ4jj1zLGKjJeoB4MSxGtc7Va4jbCSzz0ouoQjupqRadMZCq1GBawg720Bl pdo2Ck6m0mFasT7WVF1Iqf3WadNyYaLzwhhBu6WdOkok08jY6fpQ8fFG0EBD9iG9UOgs41 BW39orBcuHa6++UhOEQPMc52HNKuWtZFgfJ6Oa6qJIbZP2toU8fOyfn2K8UUUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1784022474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bsoTcN4gOIUfOGf3p48bZzeZDJjL/YfjT1YTWmmpNPE=; b=LP96mIHUFuA16DNuxJK0oAMY1HLEt9nhBrM68LGoz5RXQeqSK/DTieqKA8U5nLiTSEr7Ea k0NF1Gm40CLZW6Bw== From: Sebastian Andrzej Siewior To: Leonardo Bras Cc: Jonathan Corbet , Shuah Khan , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , Brendan Jackman , Johannes Weiner , Zi Yan , Harry Yoo , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , "Borislav Petkov (AMD)" , Randy Dunlap , Feng Tang , Dapeng Mi , Kees Cook , Marco Elver , Jakub Kicinski , Li RongQing , Eric Biggers , "Paul E. McKenney" , Nathan Chancellor , Nicolas Schier , Miguel Ojeda , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Thomas Gleixner , Douglas Anderson , Gary Guo , Christian Brauner , Pasha Tatashin , Coiby Xu , Masahiro Yamada , Frederic Weisbecker , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Marcelo Tosatti Subject: Re: [PATCH v4 4/4] slub: apply new pw_queue_on() interface Message-ID: <20260714094752.1Vi-C4fe@linutronix.de> References: <20260519012754.240804-1-leobras.c@gmail.com> <20260519012754.240804-5-leobras.c@gmail.com> <20260520145308.nay9zt6r@linutronix.de> <20260713073634.3Hrxpfcx@linutronix.de> Precedence: bulk X-Mailing-List: linux-doc@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: quoted-printable In-Reply-To: On 2026-07-13 18:40:57 [-0300], Leonardo Bras wrote: > On Mon, Jul 13, 2026 at 09:36:34AM +0200, Sebastian Andrzej Siewior wrote: > > On 2026-07-12 19:35:28 [-0300], Leonardo Bras wrote: > > > On Wed, May 20, 2026 at 04:53:08PM +0200, Sebastian Andrzej Siewior w= rote: > > > > On 2026-05-18 22:27:50 [-0300], Leonardo Bras wrote: > > > > > @@ -4733,121 +4735,121 @@ void *alloc_from_pcs(struct kmem_cache = *s, gfp_t gfp, int node) > > > > > =20 > > > > > /* > > > > > * We assume the percpu sheaves contain only local objects alth= ough it's > > > > > * not completely guaranteed, so we verify later. > > > > > */ > > > > > if (unlikely(node_requested && node !=3D numa_mem_id())) { > > > > > stat(s, ALLOC_NODE_MISMATCH); > > > > > return NULL; > > > > > } > > > > > =20 > > > > > - if (!local_trylock(&s->cpu_sheaves->lock)) > > > > > + if (!pw_trylock_local(&s->cpu_sheaves->lock)) > > > > > return NULL; > > > >=20 > > > > alloc_from_pcs() can be called from kmalloc_nolock()/ NMI context. > > > > I don't remember why exactly local_trylock_t was introduced here in= stead > > > > of a per-CPU spinlock_t.=20 > > >=20 > > > Probably to save the cost of using atomic operations on locking, and = having=20 > > > about the same restrictions that would allow using local_locks > > >=20 > > > > But there should be nothing wrong with a > > > > trylock on it from NMI as you do here. > > >=20 > > > Awesome! > >=20 > > The problem is always the unlock which requires full locking and is > > usually the problem from NMI. > > >=20 > You mean, like, the trylock succeeds in the NMI handle, does the per-cpu= =20 > operations, and then unlock()s?=20 Yes. I'm not sure what I was thinking when I wrote it back then. Try lock with local_trylock() might work under RT from NMI. However the unlock path (which needs to follow) requires an unconditional lock of the inner-lock plus a potential wakeup of the waiter.=20 : =E2=80=A6 > Thanks! > Leo Sebastian