Re: [PATCH 1/5] lockdep: Implement bitlock map allocator

From: Peter Zijlstra
Date: Thu Jun 30 2016 - 08:59:30 EST


On Mon, Jun 20, 2016 at 01:55:11PM +0900, Byungchul Park wrote:

> +struct bitlock_map {
> + struct hlist_node hash_entry;
> + unsigned long bitaddr; /* ID */
> + struct lockdep_map map;
> + int ref; /* reference count */
> +};

So this is effectively bigger than just adding a struct lockdep_map into
whatever structure holds the bit spinlock to begin with.

What is the gain?


> +static inline unsigned long get_bitaddr(int bitnum, unsigned long *addr)
> +{
> + return (unsigned long)((char *)addr + bitnum);
> +}

And given you keep these lockdep_map thingies out-of-line, the original
structure remains dense and thus the above munging can easily result in
collisions.

Now, I suppose its rather unlikely, but given its entirely silent if it
happens, this is bad.