From: Chris Mason <chris.mason@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] mutex: Apply adaptive spinning on mutex_trylock()
Date: Wed, 30 Mar 2011 07:59:13 -0400 [thread overview]
Message-ID: <1301485909-sup-4022@think> (raw)
In-Reply-To: <1301485924.4859.181.camel@twins>
Excerpts from Peter Zijlstra's message of 2011-03-30 07:52:04 -0400:
> On Wed, 2011-03-30 at 07:46 -0400, Chris Mason wrote:
> >
> > In this case, the only thing we're really missing is a way to mutex_lock
> > without the cond_resched()
>
> So you're trying to explicitly avoid a voluntary preemption point? Seems
> like a bad idea, normally people add those :-)
Yeah, but the btrfs fast path (when we're able to spin today) looks like
this:
spin_lock(parent)
binary search, select slot
pull block for that slot out of cache
spin_lock(child)
spin_unlock(parent)
If we switch it all to mutexes:
mutex_lock(parent)
binary search, select slot
pull block for that slot out of cache
mutex_lock(child)
mutex_unlock(parent)
Most of the spinning vs blocking benefits in btrfs came from doing
special things (like dropping the parent lock) when we know we're going
to block with the parent lock held. Surprise blocking in mutex_lock
isn't great.
It would probably be enough to just move the cond_resched() after the
spinning portion of the mutex_lock()
-chris
next prev parent reply other threads:[~2011-03-30 11:59 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 15:37 [RFC PATCH] mutex: Apply adaptive spinning on mutex_trylock() Tejun Heo
2011-03-23 15:40 ` Tejun Heo
2011-03-23 15:48 ` Linus Torvalds
2011-03-23 15:52 ` Tejun Heo
2011-03-23 19:46 ` Andrey Kuzmin
2011-03-24 8:18 ` Ingo Molnar
2011-03-25 3:24 ` Steven Rostedt
2011-03-25 10:29 ` Ingo Molnar
2011-03-24 9:41 ` [PATCH 1/2] Subject: mutex: Separate out mutex_spin() Tejun Heo
2011-03-24 9:41 ` [PATCH 2/2] mutex: Apply adaptive spinning on mutex_trylock() Tejun Heo
2011-03-25 3:39 ` Steven Rostedt
2011-03-25 4:38 ` Linus Torvalds
2011-03-25 6:53 ` Tejun Heo
2011-03-25 13:10 ` Steven Rostedt
2011-03-25 13:29 ` Steven Rostedt
2011-03-25 11:13 ` Andrey Kuzmin
2011-03-25 13:12 ` Steven Rostedt
2011-03-25 13:50 ` Andrey Kuzmin
2011-03-25 14:05 ` Steven Rostedt
2011-03-25 19:51 ` Ingo Molnar
2011-03-25 10:12 ` Tejun Heo
2011-03-25 10:31 ` Ingo Molnar
2011-03-29 16:37 ` Tejun Heo
2011-03-29 17:09 ` Tejun Heo
2011-03-29 17:37 ` Peter Zijlstra
2011-03-30 8:17 ` Tejun Heo
2011-03-30 11:29 ` Peter Zijlstra
2011-03-30 11:46 ` Chris Mason
2011-03-30 11:52 ` Peter Zijlstra
2011-03-30 11:59 ` Chris Mason [this message]
2011-03-24 9:42 ` [PATCH 1/2] Subject: mutex: Separate out mutex_spin() Tejun Heo
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=1301485909-sup-4022@think \
--to=chris.mason@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).