Re: [PATCH v8 13/19] locking/rwsem: Make rwsem->owner an atomic_long_t
From: Waiman Long
Date: Tue Jun 04 2019 - 11:48:54 EST
On 6/4/19 4:52 AM, Peter Zijlstra wrote:
> On Mon, May 20, 2019 at 04:59:12PM -0400, Waiman Long wrote:
>> +static inline struct task_struct *rwsem_read_owner(struct rw_semaphore *sem)
>> + return (struct task_struct *)(atomic_long_read(&sem->owner) &
>> + ~RWSEM_OWNER_FLAGS_MASK);
>> + * Return the real task structure pointer of the owner and the embedded
>> + * flags in the owner. pflags must be non-NULL.
>> + */
>> +static inline struct task_struct *
>> +rwsem_read_owner_flags(struct rw_semaphore *sem, long *pflags)
>> + long owner = atomic_long_read(&sem->owner);
>> + *pflags = owner & RWSEM_OWNER_FLAGS_MASK;
>> + return (struct task_struct *)(owner & ~RWSEM_OWNER_FLAGS_MASK);
> I got confused by the 'read' part in those nanes, I initially thought
> they paired with rwsem_set_reader_owned().
Sorry for the confusion. I initially use "get", but I am afraid that it
may get confused with "get/put" for reference counting. So I used read
> So I've done 's/rwsem_read_owner/rwsem_owner/g on it.
I am fine with getting rid of the "read" from the function names.