lkml.org 
[lkml]   [2011]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 3/7] lockdep: Annotate read/write states
From
Date
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).





\
 
 \ /
  Last update: 2011-04-18 18:29    [W:0.128 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site