public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: 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,
	 Carlos Llamas <cmllamas@google.com>,
	Huang Ying <ying.huang@intel.com>,
	 "J. R. Okajima" <hooanon05g@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	 Waiman Long <longman@redhat.com>
Subject: [PATCH 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation
Date: Tue,  6 Aug 2024 01:01:26 +0000	[thread overview]
Message-ID: <20240806010128.402852-4-cmllamas@google.com> (raw)
In-Reply-To: <20240806010128.402852-1-cmllamas@google.com>

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[];
-- 
2.46.0.rc2.264.g509ed76dc8-goog


  parent reply	other threads:[~2024-08-06  1:01 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 ` Carlos Llamas [this message]
2024-08-06  1:27   ` [PATCH 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation Waiman Long
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=20240806010128.402852-4-cmllamas@google.com \
    --to=cmllamas@google.com \
    --cc=boqun.feng@gmail.com \
    --cc=hooanon05g@gmail.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --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