On Mon, 2014-08-04 at 21:54 -0700, Davidlohr Bueso wrote: > > #ifdef CONFIG_RWSEM_SPIN_ON_OWNER > > +/* > > + * The owner field is set to RWSEM_READ_OWNED if the last owner(s) are > > + * readers. It is not reset until a writer takes over and set it to its > > + * task structure pointer or NULL when it frees the lock. So a value > > + * of RWSEM_READ_OWNED doesn't mean it currently has active readers. > > + */ > > +#define RWSEM_READ_OWNED ((struct task_struct *)-1) > > Looks rather weird... Instead of populating owner when taking the reader lock, why not just leave it NULL. Then, we can differentiate between the owner being NULL either because it is taken by reader(s) or simply because it is not taken. So something like this: static inline bool rwsem_owner_is_reader(struct rw_semaphore *sem) { return !sem->owner && rwsem_is_locked(sem)); } -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html