From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 B87B528F949; Fri, 9 Jan 2026 06:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767938578; cv=none; b=cfs991zJpX1nhL3h47mOFbgzzoAb0tt+cife4B9AHBaXdCCMeZZgXaFaLXuhP0qLl1HRjgJJGQUxlUbQbBXldnl62ifLtji+hzFiEJzKDjLXlj9XOwDEiDGybOe1YoZetI5DcJrj4IwpnBgosbskKxk3P/jyVJ30JdLmMhjSark= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767938578; c=relaxed/simple; bh=kjrPdLo2LuEMuL3ltra9YWkafT3XliJSnrixgwe1OgY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sEm1P9RHk3XvYX54MDslVI5bhlPMmAn0E01vx6M5jxasVruC+M3htQFZJwrDdTMl0w05Eg9z8TYrpZsbdttmDuNw6AGegmVfiQs8xzzsfsGZx+x0G3ZwMQO8oI2zQKnnsuKlqh7ArlyqKVJvzoxjsTuvVPW65RJJLf4oRLJGGLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 5106967373; Fri, 9 Jan 2026 07:02:49 +0100 (CET) Date: Fri, 9 Jan 2026 07:02:49 +0100 From: Christoph Hellwig To: Marco Elver Cc: Bart Van Assche , Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon , "David S. Miller" , Luc Van Oostenryck , Chris Li , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Christoph Hellwig , Dmitry Vyukov , Eric Dumazet , Frederic Weisbecker , Greg Kroah-Hartman , Herbert Xu , Ian Rogers , Jann Horn , Joel Fernandes , Johannes Berg , Jonathan Corbet , Josh Triplett , Justin Stitt , Kees Cook , Kentaro Takeda , Lukas Bulwahn , Mark Rutland , Mathieu Desnoyers , Miguel Ojeda , Nathan Chancellor , Neeraj Upadhyay , Nick Desaulniers , Steven Rostedt , Tetsuo Handa , Thomas Gleixner , Thomas Graf , Uladzislau Rezki , Waiman Long , kasan-dev@googlegroups.com, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-sparse@vger.kernel.org, linux-wireless@vger.kernel.org, llvm@lists.linux.dev, rcu@vger.kernel.org Subject: Re: [PATCH v5 10/36] locking/mutex: Support Clang's context analysis Message-ID: <20260109060249.GA5259@lst.de> References: <20251219154418.3592607-1-elver@google.com> <20251219154418.3592607-11-elver@google.com> <57062131-e79e-42c2-aa0b-8f931cb8cac2@acm.org> Precedence: bulk X-Mailing-List: linux-wireless@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: User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, Jan 09, 2026 at 12:26:55AM +0100, Marco Elver wrote: > Probably the most idiomatic option is to just factor out construction. > Clearly separating complex object construction from use also helps > readability regardless, esp. where concurrency is involved. We could > document such advice somewhere. Initializing and locking a mutex (or spinlock, or other primitive) is a not too unusual pattern, often used when inserting an object into a hash table or other lookup data structure. So supporting it without creating pointless wrapper functions would be really useful. One thing that would be nice to have and probably help here is to have lock initializers that create the lock in a held state.