[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250310130134.GS31462@noisy.programming.kicks-ass.net>
Date: Mon, 10 Mar 2025 14:01:34 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Chris Murphy <lists@...orremedies.com>
Cc: Waiman Long <longman@...hat.com>,
Михаил Гаврилов <mikhail.v.gavrilov@...il.com>,
Boqun Feng <boqun.feng@...il.com>, David Sterba <dsterba@...e.cz>,
Btrfs BTRFS <linux-btrfs@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!
On Mon, Mar 10, 2025 at 10:08:11AM +0100, Peter Zijlstra wrote:
> On Thu, Jan 26, 2023 at 10:37:56PM -0500, Chris Murphy wrote:
> >
> >
> > On Thu, Jan 26, 2023, at 7:20 PM, Waiman Long wrote:
> > > On 1/26/23 17:42, Mikhail Gavrilov wrote:
> > >>> I'm not sure whether these options are better than just increasing the
> > >>> number, maybe to unblock your ASAP, you can try make it 30 and make sure
> > >>> you have large enough memory to test.
> > >> About just to increase the LOCKDEP_CHAINS_BITS by 1. Where should this
> > >> be done? In vanilla kernel on kernel.org? In a specific distribution?
> > >> or the user must rebuild the kernel himself? Maybe increase
> > >> LOCKDEP_CHAINS_BITS by 1 is most reliable solution, but it difficult
> > >> to distribute to end users because the meaning of using packaged
> > >> distributions is lost (user should change LOCKDEP_CHAINS_BITS in
> > >> config and rebuild the kernel by yourself).
> > >
> > > Note that lockdep is typically only enabled in a debug kernel shipped by
> > > a distro because of the high performance overhead. The non-debug kernel
> > > doesn't have lockdep enabled. When LOCKDEP_CHAINS_BITS isn't big enough
> > > when testing on the debug kernel, you can file a ticket to the distro
> > > asking for an increase in CONFIG_LOCKDEP_CHAIN_BITS. Or you can build
> > > your own debug kernel with a bigger CONFIG_LOCKDEP_CHAIN_BITS.
> >
> > Fedora bumped CONFIG_LOCKDEP_CHAINS_BITS=17 to 18 just 6 months ago for debug kernels.
> > https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1921
> >
> > If 19 the recommended value I don't mind sending an MR for it. But if
> > the idea is we're going to be back here talking about bumping it to 20
> > in six months, I'd like to avoid that.
>
> Please all, also look at the lockdep_chains output for these kernels
> that need bumping this number and check if there's a particularly
> 'silly' annotation.
>
> Notably, things like giving each CPU their own lock class for a double
> lock yields O(n^2) chains, while using a single class with 1 subclass
> for the double nesting results in O(1) chains.
>
> We've had some needlessly expensive annotations like this in the past,
> and now with dyhamic classes this is even easier.
>
> So before bumping the number, check if there's something btrfs related
> that can be done better/different wrt annotations to reduce the number
> of lock chains.
So s_umount_key is having 40 instances; and I realize we have these per
filesystem lock types for a reason, but 40, how does my measly test box
end up with _40_ filesystems.
Now, even though cross-filesystem locking isn't common (rebind/overlay
etc?) this does mean most of the file system lock chains are times 40.
I also have 80 instances of kn->active, and 31 x->wait.
Powered by blists - more mailing lists