linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/9] Allow inlined spinlocks again V6
@ 2009-08-31 12:43 Heiko Carstens
  2009-08-31 12:43 ` Heiko Carstens
                   ` (10 more replies)
  0 siblings, 11 replies; 34+ messages in thread
From: Heiko Carstens @ 2009-08-31 12:43 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar, Linus Torvalds, David Miller,
	Benjamin Herrenschmidt <be>
  Cc: linux-arch, Peter Zijlstra, Arnd Bergmann, Nick Piggin,
	Martin Schwidefsky, Horst Hartmann, Christian Ehrhardt,
	Heiko Carstens

This patch set allows to have inlined spinlocks again.

V2: rewritten from scratch - now also with readable code

V3: removed macro to generate out-of-line spinlock variants since that
    would break ctags. As requested by Arnd Bergmann.

V4: allow architectures to specify for each lock/unlock variant if
    it should be kept out-of-line or inlined.

V5: simplify ifdefs as pointed out by Linus. Fix architecture compile
    breakages caused by this change.

V6: rename __spin_lock_is_small to __always_inline__spin_lock as requested
    by Ingo Molnar. That way it is more consistent with the other methods
    used to force inlining.
    Also simplify inlining by getting rid of the old variants to force
    inlining of the unlock functions.

This is hopefully the final version. I did again run the whole cross
compiles. The patch set applies on top of latest Linus' git tree, but
also applies on top of linux-next.

Ingo, I assume you don't have further objections?

Should this go in via -mm then?

---

The rationale behind this is that function calls on at least s390 are
expensive.

If one considers that server kernels are usually compiled with
!CONFIG_PREEMPT a simple spin_lock is just a compare and swap loop.
The extra overhead for a function call is significant.
With inlined spinlocks overall cpu usage gets reduced by 1%-5% on s390.
These numbers were taken with some network benchmarks. However I expect
any workload that calls frequently into the kernel and which grabs a few
locks to perform better.

The implementation is straight forward: move the function bodies of the
locking functions to static inline functions and place them in a header
file.
By default all locking code remains out-of-line. An architecture can
specify

#define __always_inline__spin_lock

in arch/<whatever>/include/asm/spinlock.h to force inlining of a locking
function.

defconfig cross compile tested for alpha, arm, x86, x86_64, ia64, m68k,
m68knommu, mips, powerpc, powerpc64, sparc64, s390, s390x.

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2009-09-01 13:59 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 12:43 [patch 0/9] Allow inlined spinlocks again V6 Heiko Carstens
2009-08-31 12:43 ` Heiko Carstens
2009-08-31 12:43 ` [patch 1/9] powerpc: rename __spin_try_lock() and friends Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:07   ` [tip:core/locking] locking, powerpc: Rename " tip-bot for Heiko Carstens
2009-08-31 17:07     ` tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 2/9] sparc: rename " Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:07   ` [tip:core/locking] locking, sparc: Rename " tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 3/9] m68k/asm-offsets: rename pt_regs offset defines Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:07   ` [tip:core/locking] locking, m68k/asm-offsets: Rename " tip-bot for Heiko Carstens
2009-08-31 17:07     ` tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 4/9] m68k/asm-offsets: rename signal defines Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-09-01 13:58   ` [tip:core/locking] locking, m68k/asm-offsets: Rename " tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 5/9] m68k: calculate thread_info offset with asm offset Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:07   ` [tip:core/locking] locking, m68k: Calculate " tip-bot for Heiko Carstens
2009-08-31 17:07     ` tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 6/9] spinlock: move spinlock function bodies to header file Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:07   ` [tip:core/locking] locking: Move " tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 7/9] spinlock: allow inlined spinlocks Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:08   ` [tip:core/locking] locking: Allow arch-inlined spinlocks tip-bot for Heiko Carstens
2009-08-31 17:08     ` tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 8/9] spinlock: simplify inlining Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:08   ` [tip:core/locking] locking: Simplify spinlock inlining tip-bot for Heiko Carstens
2009-08-31 12:43 ` [patch 9/9] spinlock: inline code for all locking variants on s390 Heiko Carstens
2009-08-31 12:43   ` Heiko Carstens
2009-08-31 17:08   ` [tip:core/locking] locking: Inline spinlock " tip-bot for Heiko Carstens
2009-08-31 15:56 ` [patch 0/9] Allow inlined spinlocks again V6 Ingo Molnar

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).