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

john stultz (johnstul@us.ibm.com)
12 Aug 2002 18:02:53 -0700


> 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

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