linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [GIT PULL] slab fixes for 3.2-rc4
Date: Thu, 22 Dec 2011 08:05:01 -0800	[thread overview]
Message-ID: <20111222160501.GD17084@google.com> (raw)
In-Reply-To: <CA+55aFyr69__vsorCXKZ7UezvXkCkZaot3=5b5xSHaYBEJ2ZKQ@mail.gmail.com>

Hello, Linus.

On Wed, Dec 21, 2011 at 06:19:34PM -0800, Linus Torvalds wrote:
> On Wed, Dec 21, 2011 at 9:05 AM, Tejun Heo <tj@kernel.org> wrote:
> >
> > machines.  (cc'ing arch) Does anyone have better insight here?  How
> > much more expensive are local irq save/restore compared to inc/dec'ing
> > preempt count on various archs?
> 
> I think powerpc does sw irq disable, so it's pretty much the same.
> 
> However, on *most* architectures, if the stupid generic "disable
> interrupts and then do the op" is too expensive, they could easily
> just do an architecture-specific "safe" version. Especially if they
> only need to do cmpxchg and add.
> 
> Many architectures can do those safely with load-locked,
> store-conditional (ie atomic_add), and do so quickly. Sure, there are
> broken cases wher ethat is really slow (original alpha is an example
> of that), but I think it's fairly rare.
>
> So both arm (in v6+) and powerpc should be able to just use the
> "atomic_add" version, with no real downside.

Hmmm... right, if actual atomic ops are used we don't need to
guarantee that percpu address translation and operation happen on the
same CPU.  The end result would be correct regardless.  Atomic ops
wouldn't be as efficient as local single op as in x86 but it shouldn't
be too expensive when vast majority of operations are happening on
cachelines which are already exclusively owned.

> So I really suspect that we could just say: "make the irq-safe version
> be the *only* version", and no architecture will really care. Sure, it
> can be more expensive, but it usually isn't. Only when done badly and
> stupidly is it nasty.

Yeah, I don't think there's any cross-architecture way of making
this_cpu ops universally faster than explicit irq/preempt_disable -
get_addr - do one or more ops - irq/preempt_enable.  Many archs can't
even load address offset with single instruction after all.  Even on
x86, with enough number of ops, the segment prefix and full address on
each op would become more expensive than explicit sequence.  Given
that, I think just providing irqsafe version and let all other cases
use the explicit ones is a good tradeoff.

Alright, I'll do that for the 3.4 merge window.

Thanks.

-- 
tejun

  reply	other threads:[~2011-12-22 16:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LFD.2.02.1111292001420.4019@tux.localdomain>
2011-11-29 19:29 ` [GIT PULL] slab fixes for 3.2-rc4 Linus Torvalds
2011-11-29 19:38   ` Linus Torvalds
2011-11-29 19:38     ` Linus Torvalds
2011-12-20  9:47   ` Pekka Enberg
2011-12-20 16:23     ` Tejun Heo
2011-12-20 16:31       ` Christoph Lameter
2011-12-20 16:31         ` Christoph Lameter
2011-12-20 19:28       ` Linus Torvalds
2011-12-20 20:28         ` Tejun Heo
2011-12-21  8:08           ` Pekka Enberg
2011-12-21 17:09             ` Tejun Heo
2011-12-21 15:16           ` Christoph Lameter
2011-12-21 17:05             ` Tejun Heo
2011-12-22  2:19               ` Linus Torvalds
2011-12-22 16:05                 ` Tejun Heo [this message]
2011-12-28 10:25                 ` Benjamin Herrenschmidt
2011-12-22 14:58               ` Christoph Lameter
2011-12-22 14:58                 ` Christoph Lameter
2011-12-22 16:08                 ` Tejun Heo
2011-12-22 17:58                   ` Christoph Lameter
2011-12-22 18:03                     ` Ingo Molnar
2011-12-22 18:31                     ` Linus Torvalds
2011-12-23 16:55                       ` Christoph Lameter
2011-12-23 20:54                         ` Linus Torvalds
2012-01-04 15:30                           ` Christoph Lameter
2012-01-04 16:07                             ` Linus Torvalds
2012-01-04 17:00                               ` Christoph Lameter
2012-01-04 23:10                                 ` Linus Torvalds
2012-01-04 23:10                                   ` Linus Torvalds
2012-01-05 19:15                                   ` Christoph Lameter
2012-01-05 19:27                                     ` Linus Torvalds
2011-12-22 18:47                     ` Tejun Heo
2011-12-20 16:26     ` Christoph Lameter
2011-12-20 16:26       ` Christoph Lameter
2011-12-21  8:06       ` Pekka Enberg
2011-12-21 15:20         ` Christoph Lameter

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=20111222160501.GD17084@google.com \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=tglx@linutronix.de \
    --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).