From nobody Fri Apr 3 02:58:28 2026 Received: from 013.lax.mailroute.net (013.lax.mailroute.net [199.89.1.16]) (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 71A1C34C141 for ; Tue, 24 Mar 2026 21:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774388562; cv=none; b=VO1KamdxWORssyYRRBbflYI+rOElJg57ZKG8N1+f7oPnZOD2oeeb8z8YZa0I5Z7FJ0efKmlkWVEwzrKohAOJOZAZtrSJg672lqHoWULThp6qHbmpY80TgX9f4dT+66bpAzDNcE9oAc16NUPHU5b7SCuRPC9nVJf4NGYWu2ymWPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774388562; c=relaxed/simple; bh=eQtD7a9qhJdriLnYS6EifS9BwlWXIfJCY2EOwu5GWlw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SpQWI7VwSzN6bHKezy+2/FREQwAPLG8NAjpckDErj66aezk7SKwYdBlNIMtaJ5XsXCZ8wb6XSTS3dn9fZ0cwAvqqg49BFCy30y158otAhIfkdtUOPPEQwf84LO0Gw9egj5vJ6+LX1Mw3P9tUHkZwxz6FcJT5QtPxP4GmmRtJHOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=yaI9TqO2; arc=none smtp.client-ip=199.89.1.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="yaI9TqO2" Received: from localhost (localhost [127.0.0.1]) by 013.lax.mailroute.net (Postfix) with ESMTP id 4fgNmw72qbzlfddr; Tue, 24 Mar 2026 21:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=mr01; t= 1774388556; x=1776980557; bh=9xZQJJIAW47P1r1b//odP86cQnf27efj6zg 7zL9D8d4=; b=yaI9TqO21GG+KRsxM2cvKsLBK43iwQEaHPpa6A/z71T2tBbDBno IBAGr8SkhH684osKjs52xIjhoOf5wFglzBbkbLiq2qPnW2BJfl/oBRrdJxyacV/J J1NWgX1djtXY0QnnYEKZoqXv1hgNM6T7jtq9O8Bg1pQRsXE8MXeZ5mvkbCeY0Q44 +EPvvBHscJonzywFq08lAeQ+/2QzpD3yln0HfYl97j+XHReatmh+YDeEMcAPN6G8 42ZEYjE7mZgz15ryMi8GKdcjHBGxBgJg62110Q3S3La25DYGLj3dCmB11/UcqR28 P6BJAecxk9IsV6VgzAmPG6LpxyfsS3bstxg== X-Virus-Scanned: by MailRoute Received: from 013.lax.mailroute.net ([127.0.0.1]) by localhost (013.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id ZBd-NDyil06z; Tue, 24 Mar 2026 21:42:36 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 013.lax.mailroute.net (Postfix) with ESMTPSA id 4fgNmq4TJXzlfdfN; Tue, 24 Mar 2026 21:42:35 +0000 (UTC) From: Bart Van Assche To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Bart Van Assche , Suren Baghdasaryan , Kent Overstreet , Nathan Chancellor Subject: [PATCH] lib: Split codetag_lock_module_list() Date: Tue, 24 Mar 2026 14:42:25 -0700 Message-ID: <20260324214226.3684605-1-bvanassche@acm.org> X-Mailer: git-send-email 2.53.0.1018.g2bb0e51243-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Letting a function argument indicate whether a lock or unlock operation should be performed is incompatible with compile-time analysis of locking operations by sparse and Clang. Hence, split codetag_lock_module_list() into two functions: a function that locks cttype->mod_lock and another function that unlocks cttype->mod_lock. No functionality has been changed. See also commit 916cc5167cc6 ("lib: code tagging framework"). Cc: Suren Baghdasaryan Signed-off-by: Bart Van Assche Acked-by: Suren Baghdasaryan --- include/linux/codetag.h | 3 ++- lib/alloc_tag.c | 8 ++++---- lib/codetag.c | 12 +++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/linux/codetag.h b/include/linux/codetag.h index 8ea2a5f7c98a..ddae7484ca45 100644 --- a/include/linux/codetag.h +++ b/include/linux/codetag.h @@ -74,8 +74,9 @@ struct codetag_iterator { .flags =3D 0, \ } =20 -void codetag_lock_module_list(struct codetag_type *cttype, bool lock); +void codetag_lock_module_list(struct codetag_type *cttype); bool codetag_trylock_module_list(struct codetag_type *cttype); +void codetag_unlock_module_list(struct codetag_type *cttype); struct codetag_iterator codetag_get_ct_iter(struct codetag_type *cttype); struct codetag *codetag_next_ct(struct codetag_iterator *iter); =20 diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 58991ab09d84..99919fe2d085 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -52,7 +52,7 @@ static void *allocinfo_start(struct seq_file *m, loff_t *= pos) loff_t node =3D *pos; =20 priv =3D (struct allocinfo_private *)m->private; - codetag_lock_module_list(alloc_tag_cttype, true); + codetag_lock_module_list(alloc_tag_cttype); if (node =3D=3D 0) { priv->print_header =3D true; priv->iter =3D codetag_get_ct_iter(alloc_tag_cttype); @@ -75,7 +75,7 @@ static void *allocinfo_next(struct seq_file *m, void *arg= , loff_t *pos) =20 static void allocinfo_stop(struct seq_file *m, void *arg) { - codetag_lock_module_list(alloc_tag_cttype, false); + codetag_unlock_module_list(alloc_tag_cttype); } =20 static void print_allocinfo_header(struct seq_buf *buf) @@ -134,7 +134,7 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, = size_t count, bool can_sl return 0; =20 if (can_sleep) - codetag_lock_module_list(alloc_tag_cttype, true); + codetag_lock_module_list(alloc_tag_cttype); else if (!codetag_trylock_module_list(alloc_tag_cttype)) return 0; =20 @@ -159,7 +159,7 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, = size_t count, bool can_sl } } =20 - codetag_lock_module_list(alloc_tag_cttype, false); + codetag_unlock_module_list(alloc_tag_cttype); =20 return nr; } diff --git a/lib/codetag.c b/lib/codetag.c index 304667897ad4..4001a7ea6675 100644 --- a/lib/codetag.c +++ b/lib/codetag.c @@ -35,12 +35,9 @@ struct codetag_module { static DEFINE_MUTEX(codetag_lock); static LIST_HEAD(codetag_types); =20 -void codetag_lock_module_list(struct codetag_type *cttype, bool lock) +void codetag_lock_module_list(struct codetag_type *cttype) { - if (lock) - down_read(&cttype->mod_lock); - else - up_read(&cttype->mod_lock); + down_read(&cttype->mod_lock); } =20 bool codetag_trylock_module_list(struct codetag_type *cttype) @@ -48,6 +45,11 @@ bool codetag_trylock_module_list(struct codetag_type *ct= type) return down_read_trylock(&cttype->mod_lock) !=3D 0; } =20 +void codetag_unlock_module_list(struct codetag_type *cttype) +{ + up_read(&cttype->mod_lock); +} + struct codetag_iterator codetag_get_ct_iter(struct codetag_type *cttype) { struct codetag_iterator iter =3D {