public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will@kernel.org>, Waiman Long <longman@redhat.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] locking: lockdep: Decrease nr_unused_locks if lock unused in zap_class()
Date: Thu, 27 Mar 2025 08:24:27 +0100	[thread overview]
Message-ID: <Z-T9K80wB4xw99jR@gmail.com> (raw)
In-Reply-To: <20250326180831.510348-1-boqun.feng@gmail.com>


* Boqun Feng <boqun.feng@gmail.com> wrote:

> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index b15757e63626..686546d52337 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -6264,6 +6264,9 @@ static void zap_class(struct pending_free *pf, struct lock_class *class)
>  		hlist_del_rcu(&class->hash_entry);
>  		WRITE_ONCE(class->key, NULL);
>  		WRITE_ONCE(class->name, NULL);
> +		/* class allocated but not used, -1 in nr_unused_locks */
> +		if (class->usage_mask == 0)
> +			debug_atomic_dec(nr_unused_locks);

Nit: capitalization in comments should follow the style of the 
surrounding code - ie. I did the change below.

Thanks,

	Ingo

======================>
 kernel/locking/lockdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 686546d52337..58d78a33ac65 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -6264,7 +6264,7 @@ static void zap_class(struct pending_free *pf, struct lock_class *class)
 		hlist_del_rcu(&class->hash_entry);
 		WRITE_ONCE(class->key, NULL);
 		WRITE_ONCE(class->name, NULL);
-		/* class allocated but not used, -1 in nr_unused_locks */
+		/* Class allocated but not used, -1 in nr_unused_locks */
 		if (class->usage_mask == 0)
 			debug_atomic_dec(nr_unused_locks);
 		nr_lock_classes--;

  parent reply	other threads:[~2025-03-27  7:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 18:08 [PATCH] locking: lockdep: Decrease nr_unused_locks if lock unused in zap_class() Boqun Feng
2025-03-26 18:26 ` Waiman Long
2025-03-26 18:31   ` Boqun Feng
2025-03-27  7:24 ` Ingo Molnar [this message]
2025-03-27  7:29 ` [tip: locking/urgent] locking/lockdep: " tip-bot2 for Boqun Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-T9K80wB4xw99jR@gmail.com \
    --to=mingo@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox