Re: [PATCH] lockdep: Allow tuning tracing keys constant.

From: Sasha Levin
Date: Mon Oct 03 2022 - 15:44:57 EST


On Fri, Sep 30, 2022 at 01:34:24PM -0400, Waiman Long wrote:
On 9/30/22 13:00, Ryan Huang wrote:
+config LOCKDEP_KEYS_BITS
+ int "Bitsize for MAX_LOCKDEP_KEYS"
+ depends on LOCKDEP && !LOCKDEP_SMALL
+ range 10 30
+ default 13
+ help
+ Try increasing this value if you hit "BUG: MAX_LOCKDEP_KEYS too low!" message.
+
config LOCKDEP_STACK_TRACE_BITS
int "Bitsize for MAX_STACK_TRACE_ENTRIES"
depends on LOCKDEP && !LOCKDEP_SMALL

The lockdep key is embedded in a bit field within the held_lock structure to utilize all the 32 bits of an integer. Changing its size will require adjusting other bit fields or expand the bit field size from 32 bits to 64 bits. 13 bits allows up to 8k unique lock classes. Unless there is good evidence that we are going to run out of that, we shouldn't change it.

Right, and this patch doesn't propose changing that (the value is
currently hardcoded to '13', and the config option defaults it to 13).

This change is about making it configurable.

--
Thanks,
Sasha