Re: [PATCH] fast reader/writer lock for gettimeofday 2.5.30

john stultz
2002-08-13T01:13:16Z

> The following patch generalizes Andrea's trick of using sequence numbers
> to create a reader region/writer lock. It against the 2.5.30 kernel.

Ah! Very nice! I have hit the xtime_lock starvation issue, and was
looking to implement something like vxtime_lock to help it (I'm also
hoping to port the vsyscall gtod to i386 as well).

> A new composite primitive 'frlock' is defined in include/linux/frlock.h
> and used to replace the rwlock xtime_lock enforce consistent access to
> the clock time variables.

My only comment is that while you have wrapped it up nicely, I'm not
sure this locking algorithm is worth generalizing. While the vxtime_lock
implementation for x86-64 might take a bit to grasp, the macros are very
short, fairly straight forward, and difficult to confuse with a standard
spin/rw_lock. Additionally, the extra complexity of managing the
sequence number isn't really being hidden (and really, I'm not sure how
one would hide it).

Maybe I'm just partial to the way Andrea did it (especially considering
I'd like to use the lock from userspace as well), but regardless this
style of rwlock is definitely needed for the xtime_lock. Very cool!

thanks
-john