From: Waiman Long <longman@redhat.com>
To: Carlos Llamas <cmllamas@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
Huang Ying <ying.huang@intel.com>,
"J. R. Okajima" <hooanon05g@gmail.com>,
Boqun Feng <boqun.feng@gmail.com>
Subject: Re: [PATCH 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation
Date: Mon, 5 Aug 2024 21:27:52 -0400 [thread overview]
Message-ID: <45ceeb38-06c4-4b8a-8b3f-afe57c891f9a@redhat.com> (raw)
In-Reply-To: <20240806010128.402852-4-cmllamas@google.com>
On 8/5/24 21:01, Carlos Llamas wrote:
> Add a comment to document the magic number '5' used in the calculation
> of MAX_LOCKDEP_CHAIN_HLOCKS. This number represents the estimated
> average depth (number of locks held) of a lock chain. This definition
> was added in commit 443cd507ce7f ("lockdep: add lock_class information
> to lock_chain and output it").
>
> Cc: Huang Ying <ying.huang@intel.com>
> Cc: J. R. Okajima <hooanon05g@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Waiman Long <longman@redhat.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
> kernel/locking/lockdep_internals.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
> index bbe9000260d0..2b429ed103a8 100644
> --- a/kernel/locking/lockdep_internals.h
> +++ b/kernel/locking/lockdep_internals.h
> @@ -119,6 +119,7 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ =
>
> #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
>
> +/* We estimate that a chain holds 5 locks on average. */
> #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
>
> extern struct lock_chain lock_chains[];
I think it is better to define another macro like
diff --git a/kernel/locking/lockdep_internals.h
b/kernel/locking/lockdep_internals.h
index bbe9000260d0..8805122cc9f1 100644
--- a/kernel/locking/lockdep_internals.h
+++ b/kernel/locking/lockdep_internals.h
@@ -119,7 +119,8 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ =
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
-#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
+#define AVG_LOCKDEP_CHAIN_DEPTH 5
+#define MAX_LOCKDEP_CHAIN_HLOCKS
(MAX_LOCKDEP_CHAINS*AVG_LOCKDEP_CHAIN_DEPTH)
extern struct lock_chain lock_chains[];
Cheers,
Longman
next prev parent reply other threads:[~2024-08-06 1:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 1:01 [PATCH 0/3] lockdep: minor config and documentation fixes Carlos Llamas
2024-08-06 1:01 ` [PATCH 1/3] lockdep: fix upper limit for LOCKDEP_*_BITS configs Carlos Llamas
2024-08-06 1:29 ` Waiman Long
2024-08-06 1:01 ` [PATCH 2/3] lockdep: clarify size " Carlos Llamas
2024-08-06 1:36 ` Waiman Long
2024-08-06 14:47 ` Carlos Llamas
2024-08-06 14:52 ` Waiman Long
2024-08-06 17:42 ` Boqun Feng
2024-08-07 14:28 ` Carlos Llamas
2024-08-06 1:01 ` [PATCH 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation Carlos Llamas
2024-08-06 1:27 ` Waiman Long [this message]
2024-08-06 14:49 ` Carlos Llamas
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=45ceeb38-06c4-4b8a-8b3f-afe57c891f9a@redhat.com \
--to=longman@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=cmllamas@google.com \
--cc=hooanon05g@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--cc=ying.huang@intel.com \
/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
all inboxes | Powered by JetHome®