public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelianov <xemul@sw.ru>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] Lockdep VS rw-semaphores strangeness
Date: Fri, 06 Apr 2007 18:19:09 +0400	[thread overview]
Message-ID: <461656DD.2000202@sw.ru> (raw)
In-Reply-To: <4616537D.20702@linux.intel.com>

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.

      reply	other threads:[~2007-04-06 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-06 10:14 [RFC] Lockdep VS rw-semaphores strangeness Pavel Emelianov
2007-04-06 14:04 ` Arjan van de Ven
2007-04-06 14:19   ` Pavel Emelianov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=461656DD.2000202@sw.ru \
    --to=xemul@sw.ru \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox