From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sasha Levin <sasha.levin@oracle.com>, Jan Kara <jack@suse.cz>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Dave Jones <davej@redhat.com>, Ingo Molnar <mingo@kernel.org>
Subject: Re: mm,console: circular dependency between console_sem and zone lock
Date: Tue, 3 Jun 2014 10:47:35 +0200 [thread overview]
Message-ID: <20140603084735.GO11096@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140602215529.0c13f91b@gandalf.local.home>
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
On Mon, Jun 02, 2014 at 09:55:29PM -0400, Steven Rostedt wrote:
> Hmm, it failed on a try lock, but on the spinlock within the trylock. I
> wonder if we should add this.
>
> Peter?
>
> -- Steve
>
> diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
> index 6815171..6579f84 100644
> --- a/kernel/locking/semaphore.c
> +++ b/kernel/locking/semaphore.c
> @@ -132,7 +132,9 @@ int down_trylock(struct semaphore *sem)
> unsigned long flags;
> int count;
>
> - raw_spin_lock_irqsave(&sem->lock, flags);
> + if (!raw_spin_trylock_irqsave(&sem->lock, flags))
> + return 1;
> +
> count = sem->count - 1;
> if (likely(count >= 0))
> sem->count = count;
I prefer not to, there is no reason the down_trylock() will fail if that
spinlock is contended. We might have just hit the release in progress.
But let me stare at the original problem..
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-06-03 8:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 2:03 Sasha Levin
2014-05-12 16:28 ` Jan Kara
2014-06-01 14:08 ` Sasha Levin
2014-06-03 1:55 ` Steven Rostedt
2014-06-03 8:47 ` Peter Zijlstra [this message]
2014-06-03 9:00 ` Peter Zijlstra
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=20140603084735.GO11096@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sasha.levin@oracle.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