From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 10/10] Change atomic_read/set to inline functions with barrier semantics.
Date: Wed, 22 Aug 2007 14:36:13 +0200 [thread overview]
Message-ID: <20070822123644.236127458@de.ibm.com> (raw)
In-Reply-To: 20070822123603.501231302@de.ibm.com
[-- Attachment #1: 010-atomic_t.diff --]
[-- Type: text/plain, Size: 1870 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
After doing some tests this seems to be the best variant for s390 and
should be correct as well. With gcc 4.2.1 we get the following kernel
image sizes using the default configuration:
atomic_t type volatile, atomic_read/set defines 5311824 bytes
atomic_t type int, atomic_read/set defines 5270864 bytes
atomic_t type int, atomic_read/set inline asm 5279056 bytes
atomic_t type int, atomic_read/set inline barrier 5270864 bytes
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
include/asm-s390/atomic.h | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
Index: quilt-2.6/include/asm-s390/atomic.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/atomic.h
+++ quilt-2.6/include/asm-s390/atomic.h
@@ -67,8 +67,17 @@ typedef struct {
#endif /* __GNUC__ */
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) (((v)->counter) = (i))
+static inline int atomic_read(const atomic_t *v)
+{
+ barrier();
+ return v->counter;
+}
+
+static inline void atomic_set(atomic_t *v, int i)
+{
+ v->counter = i;
+ barrier();
+}
static __inline__ int atomic_add_return(int i, atomic_t * v)
{
@@ -182,8 +191,17 @@ typedef struct {
#endif /* __GNUC__ */
-#define atomic64_read(v) ((v)->counter)
-#define atomic64_set(v,i) (((v)->counter) = (i))
+static inline long long atomic64_read(const atomic64_t *v)
+{
+ barrier();
+ return v->counter;
+}
+
+static inline void atomic64_set(atomic64_t *v, long long i)
+{
+ v->counter = i;
+ barrier();
+}
static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
{
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
prev parent reply other threads:[~2007-08-22 12:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-22 12:36 [patch 00/10] s390 patches for 2.6.23-rc3 Martin Schwidefsky
2007-08-22 12:36 ` [patch 01/10] cio: dont forget to set last slot to NULL in ccw_uevent() Martin Schwidefsky
2007-08-22 12:36 ` [patch 02/10] cio: change confusing message in cmf Martin Schwidefsky
2007-08-22 12:36 ` [patch 03/10] qdio: fix EQBS handling on CCQ96 Martin Schwidefsky
2007-08-22 12:36 ` [patch 04/10] qdio: Refresh buffer states for IQDIO Asynchronous output queue Martin Schwidefsky
2007-08-22 12:36 ` [patch 05/10] vmur: fix diag14 exceptions with addresses > 2GB Martin Schwidefsky
2007-08-22 12:36 ` [patch 06/10] vmur: fix reference counting for vmur device structure Martin Schwidefsky
2007-08-22 12:36 ` [patch 07/10] disassembler: fix b2 opcodes like srst, bsg, and others Martin Schwidefsky
2007-08-22 12:36 ` [patch 08/10] hypfs: inode corruption due to missing locking Martin Schwidefsky
2007-08-22 12:36 ` [patch 09/10] kprobes: fix instruction length calculation Martin Schwidefsky
2007-08-22 12:36 ` Martin Schwidefsky [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=20070822123644.236127458@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.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