From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Peter Williams <pwil3058@bigpond.net.au>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [patch, 2.6.10-rc2] sched: fix ->nr_uninterruptible handling bugs
Date: Wed, 17 Nov 2004 11:26:51 +0100 [thread overview]
Message-ID: <20041117102651.GA13768@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.58.0411161509190.2222@ppc970.osdl.org>
* Linus Torvalds <torvalds@osdl.org> wrote:
> On Wed, 17 Nov 2004, Ingo Molnar wrote:
> >
> > maybe, but why? Atomic ops are still a tad slower than normal ops
>
> A "tad" slower?
>
> An atomic op is pretty much as expensive as a spinlock/unlock pair on
> x86. Not _quite_, but it's pretty close.
it really depends on the layout of the data structure. The main cost
that we typically see combined with atomic ops and spinlocks is if the
target of the atomic op is a global/shared variable, in which case the
cacheline bounce cost is prohibitive and controls over any micro-cost.
But in this particular rq->nr_uninterruptible case we have per-CPU
variables, so the cost of the atomic op is, in theory, quite close to
the cost of a normal op.
In practice this means it's 10 cycles more expensive on P3-style CPUs.
(I think on P4 style CPUs it should be much closer to 0, but i havent
been able to reliably time it there - cycle measurements show a 76
cycles cost which is way out of line.)
On a UP Athlon64 the cost of a LOCK-ed op is exactly the same as without
the LOCK prefix - but here the CPU can take shortcuts because in theory
it can skip any cache coherency considerations altogether. (albeit the
atomic op should still have relevance to DMA-able data, perhaps UP-mode
CPUs ignore that case.) Also, i think it ought to be near zero-cost on
a Crusoe-style CPU?
Ingo
next prev parent reply other threads:[~2004-11-17 9:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-16 11:32 [patch, 2.6.10-rc2] sched: fix ->nr_uninterruptible handling bugs Ingo Molnar
2004-11-16 22:19 ` Peter Williams
2004-11-16 23:28 ` Ingo Molnar
2004-11-16 23:10 ` Linus Torvalds
2004-11-17 10:26 ` Ingo Molnar [this message]
2004-11-17 15:52 ` Linus Torvalds
2004-11-18 16:21 ` Ingo Molnar
2005-01-28 0:53 ` Paul Jackson
2005-01-28 1:06 ` Linus Torvalds
2005-01-28 2:14 ` Paul Jackson
2005-01-28 4:28 ` Ingo Molnar
2005-01-28 5:18 ` Paul Jackson
2005-01-28 6:01 ` Andi Kleen
2004-11-16 23:48 ` Peter Williams
2004-11-16 22:49 ` Nick Piggin
2004-11-16 23:03 ` Nick Piggin
2004-11-16 23:32 ` Peter Williams
2004-11-16 23:37 ` Nick Piggin
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=20041117102651.GA13768@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pwil3058@bigpond.net.au \
--cc=torvalds@osdl.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