linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Peter Fordham <peter.fordham@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: spinlocks in ext4
Date: Mon, 8 Oct 2012 20:54:25 -0400	[thread overview]
Message-ID: <20121009005425.GB20682@thunk.org> (raw)
In-Reply-To: <CAK5=ZRLQErM1dOT_Tuf-SC4-3VK_o6TRg-0k8A=iQGgFY6S+aw@mail.gmail.com>

On Mon, Oct 08, 2012 at 04:33:45PM -0700, Peter Fordham wrote:
> 
> Can someone give me a quick outline of why spinlocks are required in
> the EXT4 code? Don't all file-system requests originate from user
> context, hence meaning all locking be done with mutexes or semaphores.

Mutexes are incredibly expensive in the contended case, since you
basically have to take a trip through the scheduler.  If the other CPU
is only going to be holding the lock for a few dozen cycles, a
spinlock is far preferable to a mutex.

> I'm doing some profiling on an ARM device it's showing up spin unlock
> taking a lot of time and I'd like to migrate to using mutex's instead
> since they don't incur penalties from synchronization instructions
> like DMB.  I'm guessing there's some underlying reason why this isn't
> safe and I'd like to understand it.

Why in the world does ARM have expensive spinlocks?  ARM64 is *doomed*
if this is a fundamental property of the ARM processor design...

   	     		 	     	 - Ted

  reply	other threads:[~2012-10-09  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 23:33 spinlocks in ext4 Peter Fordham
2012-10-09  0:54 ` Theodore Ts'o [this message]
2012-10-09  1:10   ` Theodore Ts'o
2012-10-11 18:37     ` Peter Fordham
2012-10-12  0:17       ` Theodore Ts'o

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=20121009005425.GB20682@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=peter.fordham@gmail.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;
as well as URLs for NNTP newsgroup(s).