[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 at 12:57, <david.vrabel@xxxxxxxxxx> wrote:
> 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.

Well, the style I've pointed out is the one used in well formed code
(and in fact I have to remind myself of this each time I omit one or
more of the three expressions). But as said, I'm not demanding a
re-submission just because of this (and if I remember to do so, I
may well fix it up while committing).

>>> --- 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.

Ah, okay, patch 2 indeed makes this necessary.

Both patches
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
then.

Jan


_______________________________________________
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®.