Re: [RFC][PATCH 3/7] lockdep: Annotate read/write states

From: Steven Rostedt
Date: Mon Apr 18 2011 - 12:26:42 EST


On Sun, 2011-04-17 at 11:45 +0200, Peter Zijlstra wrote:

> Currently the read/write status of a lock while it's acquired is denoted by a
> monotonically increasing variable where:
>
> 0 - WRITE
> 1 - READ
> 2 - RECURSIVE READ
>
> In this patch, we propose to modify this distinction from a monotonically
> increasing variable to a bit mask where:
>
> 0x1 - WRITE
> 0x2 - READ
> 0x4 - RECURSIVE READ
>


> /*
> @@ -286,6 +287,15 @@ extern void lockdep_init_map(struct lock
>
> #define lockdep_set_novalidate_class(lock) \
> lockdep_set_class(lock, &__lockdep_no_validate__)
> +
> +/* lock_state bits */
> +#define _W_ 0
> +#define _R_ (_W_ + 1)
> +#define _RR_ (_W_ + 2)
> +#define _FIRST_RR_ (_W_ + 3)

Eek!!! Please comment these. I hate trying to figure out what RR means.
If I did not read the change log, my first thought was "Round Robin".

Adding something like:

/*
* lock_state bits:
* WRITE
* READ
* RECURSIVE_READ
* FIRST RECURSIVE_READ
*/

Above that would help tremendously. This code is obfuscated enough, we
need many more comments. (I plan on sending out patches to do this too).



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/