Re: [PATCH 1/2] lockdep: lock_set_lock_cmp_fn()

From: Kent Overstreet
Date: Thu Feb 23 2023 - 14:27:20 EST


On Thu, Feb 23, 2023 at 02:01:58PM +0100, Peter Zijlstra wrote:
> I would suggest the same as last time; integrate this in the class
> setting zoo of functions.

I don't really see a particular zoo, things like pretty scattered to me.
With lockdep_init_map_type?

> If you insiste, please keep it one function
> and force print_fn when cmp_fn. We don't want people to skimp out on
> this.

That's easily done.

>
> Other than that, I don't think this can fully replace subclasses, since
> subclasses would allow lock hierarchies with other classes inter-twined,
> while this really relies on pure class nesting.
>
> That is:
>
> A/0
> B
> A/1
>
> is a valid subclass nesting set, but you can't achieve the same with
> this.

Why not just assign those As to two different classes?

> That said; it does seem like a very useful additional annotation for the
> more complex nesting sets.
>
> Thanks!

Cheers