Re: [RFC] Lockdep VS rw-semaphores strangeness

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux