From: tip-bot for Heiko Carstens <heiko.carstens@de.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@redhat.com, torvalds@linux-foundation.org,
a.p.zijlstra@chello.nl, schwidefsky@de.ibm.com,
ehrhardt@linux.vnet.ibm.com, arnd@arndb.de,
akpm@linux-foundation.org, heiko.carstens@de.ibm.com,
zippel@linux-m68k.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, hpa@zytor.com, paulus@samba.org,
horsth@linux.vnet.ibm.com, davem@davemloft.net,
benh@kernel.crashing.org, geert@linux-m68k.org,
linux-arch@vger.kernel.org, mingo@elte.hu,
nickpiggin@yahoo.com.au
Subject: [tip:core/locking] locking: Simplify spinlock inlining
Date: Mon, 31 Aug 2009 17:08:20 GMT [thread overview]
Message-ID: <tip-bb7bed082500179519c7caf0678ba3bed9752658@git.kernel.org> (raw)
In-Reply-To: <20090831124418.848735034@de.ibm.com>
Commit-ID: bb7bed082500179519c7caf0678ba3bed9752658
Gitweb: http://git.kernel.org/tip/bb7bed082500179519c7caf0678ba3bed9752658
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
AuthorDate: Mon, 31 Aug 2009 14:43:38 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 Aug 2009 18:08:51 +0200
locking: Simplify spinlock inlining
For !DEBUG_SPINLOCK && !PREEMPT && SMP the spin_unlock()
functions were always inlined by using special defines which
would call the __raw* functions.
The out-of-line variants for these functions would be generated
anyway.
Use the new per unlock/locking variant mechanism to force
inlining of the unlock functions like before. This is not a
functional change, we just get rid of one additional way to
force inlining.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Horst Hartmann <horsth@linux.vnet.ibm.com>
Cc: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <20090831124418.848735034@de.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/linux/spinlock.h | 46 +++++---------------------------------
include/linux/spinlock_api_smp.h | 12 ++++++++++
2 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index da76a06..f0ca7a7 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -259,50 +259,16 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
#define spin_lock_irq(lock) _spin_lock_irq(lock)
#define spin_lock_bh(lock) _spin_lock_bh(lock)
-
#define read_lock_irq(lock) _read_lock_irq(lock)
#define read_lock_bh(lock) _read_lock_bh(lock)
-
#define write_lock_irq(lock) _write_lock_irq(lock)
#define write_lock_bh(lock) _write_lock_bh(lock)
-
-/*
- * We inline the unlock functions in the nondebug case:
- */
-#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \
- !defined(CONFIG_SMP)
-# define spin_unlock(lock) _spin_unlock(lock)
-# define read_unlock(lock) _read_unlock(lock)
-# define write_unlock(lock) _write_unlock(lock)
-# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
-# define read_unlock_irq(lock) _read_unlock_irq(lock)
-# define write_unlock_irq(lock) _write_unlock_irq(lock)
-#else
-# define spin_unlock(lock) \
- do {__raw_spin_unlock(&(lock)->raw_lock); __release(lock); } while (0)
-# define read_unlock(lock) \
- do {__raw_read_unlock(&(lock)->raw_lock); __release(lock); } while (0)
-# define write_unlock(lock) \
- do {__raw_write_unlock(&(lock)->raw_lock); __release(lock); } while (0)
-# define spin_unlock_irq(lock) \
-do { \
- __raw_spin_unlock(&(lock)->raw_lock); \
- __release(lock); \
- local_irq_enable(); \
-} while (0)
-# define read_unlock_irq(lock) \
-do { \
- __raw_read_unlock(&(lock)->raw_lock); \
- __release(lock); \
- local_irq_enable(); \
-} while (0)
-# define write_unlock_irq(lock) \
-do { \
- __raw_write_unlock(&(lock)->raw_lock); \
- __release(lock); \
- local_irq_enable(); \
-} while (0)
-#endif
+#define spin_unlock(lock) _spin_unlock(lock)
+#define read_unlock(lock) _read_unlock(lock)
+#define write_unlock(lock) _write_unlock(lock)
+#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
+#define read_unlock_irq(lock) _read_unlock_irq(lock)
+#define write_unlock_irq(lock) _write_unlock_irq(lock)
#define spin_unlock_irqrestore(lock, flags) \
do { \
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 1a411e3..7a7e18f 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -60,6 +60,18 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
__releases(lock);
+/*
+ * We inline the unlock functions in the nondebug case:
+ */
+#if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT)
+#define __always_inline__spin_unlock
+#define __always_inline__read_unlock
+#define __always_inline__write_unlock
+#define __always_inline__spin_unlock_irq
+#define __always_inline__read_unlock_irq
+#define __always_inline__write_unlock_irq
+#endif
+
#ifndef CONFIG_DEBUG_SPINLOCK
#ifndef CONFIG_GENERIC_LOCKBREAK
next prev parent reply other threads:[~2009-08-31 17:11 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
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-bot for Heiko Carstens [this message]
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
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=tip-bb7bed082500179519c7caf0678ba3bed9752658@git.kernel.org \
--to=heiko.carstens@de.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=ehrhardt@linux.vnet.ibm.com \
--cc=geert@linux-m68k.org \
--cc=horsth@linux.vnet.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=nickpiggin@yahoo.com.au \
--cc=paulus@samba.org \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=zippel@linux-m68k.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).