linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [Question] ARM/ARM64: Ticket Spinlock With GENERIC_BREAKLOCK
Date: Wed, 23 Apr 2014 14:09:01 +0100	[thread overview]
Message-ID: <20140423130901.GC5649@arm.com> (raw)
In-Reply-To: <53508F7B.2000400@marvell.com>

On Fri, Apr 18, 2014 at 03:35:39AM +0100, Leo Yan wrote:
> hi,

Hello,

> I noticed now for ARM and ARM64 both have disabled GENERIC_BREAKLOCK, 
> and i found the patch "ARM: 7484/1: Don't enable GENERIC_LOCKBREAK with 
> ticket spinlocks" to remove related configuration.
> 
> The ticket spinlock will be helpful for spinlock's performance, but 
> after disabled LOCKBREAK, it will always disable the preempt when the 
> cpu is spinning to wait for the lock.
> 
> So even after have refined the spinlock with ticket algorithm, we still 
> need LOCKBREAK for the cpu has the chance to do scheduling so that other 
> threads have chance can run.

The problem with GENERIC_LOCKBREAK is that we no longer end up using the
lock() function. Instead, we trylock() in a busy loop, so if the machine
doesn't have pending interrupts or other tasks to run, we end up chewing
power in a busy loop while the lock is contended. Worse still, we're polling
the lock value, so the relevant cacheline will be thrasing between all
waiters (and potentially the CPU trying to unlock()!).

If latency is an issue for you, have you considered either using a mutex
(where we explicitly block) or something like PREEMPT_RT instead?

Will

      reply	other threads:[~2014-04-23 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18  2:35 [Question] ARM/ARM64: Ticket Spinlock With GENERIC_BREAKLOCK Leo Yan
2014-04-23 13:09 ` Will Deacon [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=20140423130901.GC5649@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).