Re: [PATCH v3 17/24] locking/lockdep: Free lock classes that are no longer in use

2018-12-07 Thread Bart Van Assche
On Fri, 2018-12-07 at 13:14 +0100, Peter Zijlstra wrote: > On Thu, Dec 06, 2018 at 05:11:41PM -0800, Bart Van Assche wrote: > > + if (WARN_ON_ONCE(!hlock_class(prev)->hash_entry.pprev) || > > + WARN_ONCE(!hlock_class(next)->hash_entry.pprev, > > + KERN_INFO "Detected use-aft

Re: [PATCH v3 17/24] locking/lockdep: Free lock classes that are no longer in use

2018-12-07 Thread Peter Zijlstra
On Thu, Dec 06, 2018 at 05:11:41PM -0800, Bart Van Assche wrote: > + if (WARN_ON_ONCE(!hlock_class(prev)->hash_entry.pprev) || > + WARN_ONCE(!hlock_class(next)->hash_entry.pprev, > + KERN_INFO "Detected use-after-free of lock class %s\n", > + hlock_cl

[PATCH v3 17/24] locking/lockdep: Free lock classes that are no longer in use

2018-12-06 Thread Bart Van Assche
Instead of leaving lock classes that are no longer in use in the lock_classes array, reuse entries from that array that are no longer in use. Maintain a linked list of free lock classes with list head 'free_lock_class'. Initialize that list from inside register_lock_class() instead of from inside l