From: Lance Yang <lance.yang@linux.dev>
To: Waiman Long <llong@redhat.com>, peterz@infradead.org
Cc: mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com,
linux-kernel@vger.kernel.org, Lance Yang <ioworker0@gmail.com>,
Zi Li <zi.li@linux.dev>
Subject: Re: [WARN] LOCKDEP: MAX_LOCKDEP_CHAIN_HLOCKS too low
Date: Tue, 27 May 2025 19:59:26 +0800 [thread overview]
Message-ID: <33103ab3-6237-4215-b8de-bef680bef691@linux.dev> (raw)
In-Reply-To: <25e2293a-f49e-4bc9-bf80-efb66d87c7cb@redhat.com>
On 2025/5/27 13:53, Waiman Long wrote:
> MAX_LOCKDEP_CHAIN_HLOCKS is composed of 2 parts - (1 <<
> MAX_LOCKDEP_CHAINS_BITS) and AVG_LOCKDEP_CHAIN_DEPTH (5). I believe that
> the average lock chain length is probably bigger than 5 now. We will
> have to check the /proc/lockdep file to figure out if we should increase
> it as well. Anyway, I think we should increase
Yeah, just checked `/proc/lockdep_stats` on my machine, and it shows
'max locking depth: 30':
$ cat /proc/lockdep_stats
lock-classes: 2074 [max: 8192]
direct dependencies: 22596 [max: 32768]
indirect dependencies: 124267
all direct dependencies: 527384
dependency chains: 51354 [max: 65536]
dependency chain hlocks used: 327679 [max: 327680]
dependency chain hlocks lost: 1
in-hardirq chains: 209
in-softirq chains: 1068
in-process chains: 50076
stack-trace entries: 306274 [max: 524288]
number of stack traces: 11921
number of stack hash chains: 8482
combined max dependencies: 2651851138
hardirq-safe locks: 85
hardirq-unsafe locks: 1301
softirq-safe locks: 284
softirq-unsafe locks: 1123
irq-safe locks: 303
irq-unsafe locks: 1301
hardirq-read-safe locks: 4
hardirq-read-unsafe locks: 312
softirq-read-safe locks: 12
softirq-read-unsafe locks: 307
irq-read-safe locks: 12
irq-read-unsafe locks: 312
uncategorized locks: 352
unused locks: 0
max locking depth: 30
max bfs queue depth: 379
max lock class index: 2073
debug_locks: 0
zapped classes: 6
zapped lock chains: 163
large chain blocks: 0
And, the average lock chain depth could be calculated as:
dependency chain hlocks used (327679) / dependency chains (51354) ~= 6.38
Seems like we should also consider bumping 'AVG_LOCKDEP_CHAIN_DEPTH' to
something like 7 or higher.
> CONFIG_LOCKDEP_CHAINS_BITS to at least 17, those we may still hit the
> "MAX_LOCKDEP_CHAIN_HLOCKS too low" if we run a variety of different
> workloads without reboot.
Agreed. We may still hit this issue, but tweaking these values can make
it less likely ;)
Thanks,
Lance
prev parent reply other threads:[~2025-05-27 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 2:02 Lance Yang
2025-05-27 4:48 ` Waiman Long
2025-05-27 5:33 ` Lance Yang
2025-05-27 5:53 ` Waiman Long
2025-05-27 11:59 ` Lance Yang [this message]
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=33103ab3-6237-4215-b8de-bef680bef691@linux.dev \
--to=lance.yang@linux.dev \
--cc=boqun.feng@gmail.com \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llong@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--cc=zi.li@linux.dev \
/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®