lkml.org 
[lkml]   [2013]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 3/4] rwsem: implement write lock stealing
From
On Fri, Feb 8, 2013 at 11:30 PM, Hillf Danton <dhillf@gmail.com> wrote:
> On Sat, Feb 9, 2013 at 10:45 AM, Michel Lespinasse <walken@google.com> wrote:
>> + if (waiter->type != RWSEM_WAITING_FOR_WRITE) {
>> + list_del(&waiter->list);
>> +
>> + /* Set RWSEM_WAITING_BIAS before waking the last reader
>> + * so we know there will be a remaining active locker.
>> + */
>> + if (!(--readers) && !list_empty(&sem->wait_list))
>> + rwsem_atomic_add(RWSEM_WAITING_BIAS, sem);
>> +
>> + tsk = waiter->task;
>> + smp_mb();
>
> For what with mb?

This is the same mb that used to be before the readers_only label
before this change.
The intention is that the write to waiter->task must be the last
access to waiter - after that, the reader is granted the lock so it
could do anything, including deallocating the waiter structure as it
gets out of rwsem_down_read_failed() and possibly deallocating the
task structure if it exits

--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.


\
 
 \ /
  Last update: 2013-02-09 09:21    [W:0.068 / U:1.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site