On 9/4/24 2:00 PM, Badhri Jagan Sridharan wrote:
https://lore.kernel.org/all/ZsiYRAJST%2F2hAju1@xxxxxxxxxxxxxxxxx/ was already accepted
Thanks, I hadn't noticed this yet.
and is perhaps better than what you are suggesting as it does not use the internal methods of mutex_init().
Although I do not have a strong opinion about which patch is sent to Linus, I think my patch has multiple advantages compared to the patch mentioned above: - Cleaner. lockdep_set_class() is not used. Hence, it is not possible that the wrong lockdep key is used (the one assigned by mutex_init()). - The lock_class_key declaration occurs close to the sw->lock declaration. - The lockdep_register_key() call occurs close to __mutex_init() call that uses the registered key. - Needs less memory in debug kernels. The advantage of __mutex_init() compared to mutex_init() is that it does not allocate (static) memory for a lockdep key. Thanks, Bart.