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 949FA2E091E for ; Mon, 4 May 2026 07:28:31 +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=1777879716; cv=none; b=ai3zdefLO13ud/Bk2TAaSFloJTwRlhzO7iZfXl/V0wuL1DdHoztLYLYXDeX/kt/d4+UXjErAJgyjxgi+jlyThJZfuhKaLfthLGd9dSKZsKI1V6IR4t8M/w6Lbbs0Ew68V6rCxyfLCVrEax1g9oCCTF5+th2jkieqXQ1QhdZ1Qho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777879716; c=relaxed/simple; bh=cqaTCB2T+NgjYyYDULhankanUGNMgpTKLiehr3KHm0I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lxBujPHaNdJ3ioqGLtefTLBa+Ncu49c7Y/cXqm75qAkWI4dBzQ/8jyf8LvRe0OpVqSMcngmx2ln0ORmMMfyNLf/qSsQ7lQDgp6+mzSSzd8b4M/omxjjz6j7fF2EJ5PzTJSfKR7mJWSmC1j82B0x+g6tmdAhmMMojvX2eR+2vbFw= 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=tvZQ8Tt7; 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="tvZQ8Tt7" 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=7pSBis/6H3VzwfTe3fHrleajvF1hwwr5CyaZFtzN73M=; b=tvZQ8Tt7egRepbDULNjJY14M3l +ryxCi2uaMbi07EQqwsD1FrBvD1T2oydobr9KS1ogUYr1dLP6aaJ5lqsbvnupLqWmirCPkbEn6SBx 9c4R/P/1GW9orxnW4dwwxemRUgyra+hwotZssDY/66o4/xrOV12ij5f7mjFOjbv5040AvqUTsFVyw b/7iV8iPbIBy7Kndj5vq2tjE1xwB1FlzFeLikPqH7J1CUXVEDzTs5dSMNZS93IfpcrA93Qg+GJnZl FbbTIvKHb+JDtALEzWO3WW2yg62inKpCR40nLd3IR4YsXZLUk3ehtQZUTTCMDGzPmw/JULjZQh3F9 65c3BiqQ==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wJnjA-00000000VWf-2IUk; Mon, 04 May 2026 07:28:28 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 7717F3013A0; Mon, 04 May 2026 09:28:26 +0200 (CEST) Date: Mon, 4 May 2026 09:28:26 +0200 From: Peter Zijlstra To: Heiner Kallweit Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Linux Kernel Mailing List Subject: Re: [PATCH] lockdep: constify usage of struct lock_class_key where possible Message-ID: <20260504072826.GL3126523@noisy.programming.kicks-ass.net> References: 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: On Tue, Apr 28, 2026 at 11:05:25PM +0200, Heiner Kallweit wrote: > Constify usage of struct lock_class_key where possible. This requires > to constify also usage of struct lockdep_subclass_key in two places. > > Especially relevant is constification of lockdep_map.key, as it makes > clear that the key isn't changed during lifetime of struct lockdep_map. > > Signed-off-by: Heiner Kallweit > --- > include/linux/lockdep.h | 18 ++++++++++-------- > include/linux/lockdep_types.h | 2 +- > kernel/locking/lockdep.c | 12 ++++++------ > 3 files changed, 17 insertions(+), 15 deletions(-) > > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h > index 621566345..3fa2b62f2 100644 > --- a/include/linux/lockdep.h > +++ b/include/linux/lockdep.h > @@ -125,25 +125,27 @@ extern void lockdep_unregister_key(struct lock_class_key *key); > * to lockdep: > */ > > -extern void lockdep_init_map_type(struct lockdep_map *lock, const char *name, > - struct lock_class_key *key, int subclass, u8 inner, u8 outer, u8 lock_type); > +void lockdep_init_map_type(struct lockdep_map *lock, const char *name, > + const struct lock_class_key *key, int subclass, > + u8 inner, u8 outer, u8 lock_type); > @@ -252,9 +254,9 @@ static inline int lock_is_held(const struct lockdep_map *lock) > #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) > #define lockdep_is_held_type(lock, r) lock_is_held_type(&(lock)->dep_map, (r)) > > -extern void lock_set_class(struct lockdep_map *lock, const char *name, > - struct lock_class_key *key, unsigned int subclass, > - unsigned long ip); > +void lock_set_class(struct lockdep_map *lock, const char *name, > + const struct lock_class_key *key, unsigned int subclass, > + unsigned long ip); > It is also silently removing extern, why?