[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCHv3 2/2] spinlock: fair read-write locks



On 03/02/16 11:28, Jan Beulich wrote:
>>>> On 01.02.16 at 12:31, <david.vrabel@xxxxxxxxxx> wrote:
>> +void queue_write_lock_slowpath(rwlock_t *lock)
>> +{
>> +    u32 cnts;
>> +
>> +    /* Put the writer into the wait queue. */
>> +    spin_lock(&lock->lock);
>> +
>> +    /* Try to acquire the lock directly if no reader is present. */
>> +    if ( !atomic_read(&lock->cnts) &&
>> +         (atomic_cmpxchg(&lock->cnts, 0, _QW_LOCKED) == 0) )
>> +        goto unlock;
>> +
>> +    /*
>> +     * Set the waiting flag to notify readers that a writer is pending,
>> +     * or wait for a previous writer to go away.
>> +     */
>> +    for (;;)
> 
> Since everything else here has been nicely converted to Xen style,
> strictly speaking these should be
> 
>     for ( ; ; )
> 
> but of course this is no reason to block the patch. Since however,
> as said in reply to patch 1, ...

TBH, I really think you're pointlessly nit-picking here.  This change
would make zero impact on readability.

>> --- a/xen/include/xen/rwlock.h
>> +++ b/xen/include/xen/rwlock.h
>> @@ -3,6 +3,188 @@
>>  
>>  #include <xen/spinlock.h>
> 
> ... this should go away if possible, it would be nice for the cosmetic
> thing above to also be fixed up at once.

The rwlock structure now includes a spinlock, so this #include is
required here.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.