Re: [RFC PATCH 01/12] locking/lockdep: Rework lockdep_set_novalidate_class()

Peter Zijlstra
2018-11-10T22:43:39Z

On Thu, Nov 08, 2018 at 03:34:17PM -0500, Waiman Long wrote:
> The current lockdep_set_novalidate_class() implementation is like
> a hack. It assigns a special class key for that lock and calls
> lockdep_init_map() twice.

Ideally it would go away.. it is not thing that should be used.

> This patch changes the implementation to make it more general so that
> it can be used by other special lock class types. A new "type" field
> is added to both the lockdep_map and lock_class structures.
>
> The new field can now be used to designate a lock and a class object
> as novalidate. The lockdep_set_novalidate_class() call, however, should
> be called before lock initialization which calls lockdep_init_map().

I don't really feel like this is something that should be made easier or
better.

> @@ -102,6 +100,8 @@ struct lock_class {
> int name_version;
> const char *name;
>
> + unsigned int flags;
> +
> #ifdef CONFIG_LOCK_STAT
> unsigned long contention_point[LOCKSTAT_POINTS];
> unsigned long contending_point[LOCKSTAT_POINTS];

Esp. not at the cost of growing the data structures.