Re: [RFC][PATCH 2/5] signal: Add rwlock to protect sighand->action

From: Peter Zijlstra
Date: Fri Sep 30 2011 - 11:26:12 EST


On Fri, 2011-09-30 at 16:12 +0100, Matt Fleming wrote:
>
> As sighand->action is read much more frequently than written a rwlock
> makes the most sense here.

Ha! you would think so, but then you'd forget that
read_lock()+read_unlock() are atomic ops modifying the lock state as
well. Furthermore rwlocks aren't fair by any means.

Therefore rwlock_t should never be used, use a spinlock_t possibly in
combination with RCU or seqcount etc..
--
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/