lkml.org 
[lkml]   [2007]   [Apr]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 06 Apr 2007 18:19:09 +0400
FromPavel Emelianov <>
SubjectRe: [RFC] Lockdep VS rw-semaphores strangeness
Arjan van de Ven wrote:
> Pavel Emelianov wrote:
>> I've already caught a fake warning when trying to write-lock
>> an mm->mmap_sem with another mm's mmap_sem write-locked. With the
>> patch attached everything works, fine.
>>
> btw why is that a fake warning? what is your guarantee that you never
> ever do it in the opposite direction from the other thread as well?
> 

down_write(&mm->mmap_sem);
if (down_write_trylock(&another_mm->mmap_sem)) {
      ...
      up_write(...);
}
up_write(&mm->mmap_sem);
will never deadlock as if I have another thread is doing

down_write(&another_mm->mmap_sem);
if (down_write_trylock(&mm->mmap_sem)) {
      ...
      up_write(...);
}
up_write(&another_mm->mmap_sem);
booth will fail to trylock and go on.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-06 14:17    [from the cache]
©2003-2008