Skip to contentSkip to conversation

x86-64: reduce SMP locks table size

PATCH In review Jan Beulich 2 participants 3 messages Apr 21, 2010 – Apr 29, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64: reduce SMP locks table size

... by using relative pointers instead of absolute ones, thus cutting the table size by half.

---
 arch/x86/include/asm/alternative-asm.h |    4 +-
 arch/x86/include/asm/alternative.h     |    4 +-
 arch/x86/kernel/alternative.c          |   45 ++++++++++++++++++---------------
 3 files changed, 29 insertions(+), 24 deletions(-)
arch/x86/include/asm/alternative-asm.h +2 -2
@@ -6,8 +6,8 @@
 	.macro LOCK_PREFIX
 1:	lock
 	.section .smp_locks,"a"
-	_ASM_ALIGN
-	_ASM_PTR 1b
+	.balign 4
+	.long 1b - .
 	.previous
 	.endm
 #else
arch/x86/include/asm/alternative.h +2 -2
@@ -30,8 +30,8 @@
 #ifdef CONFIG_SMP
 #define LOCK_PREFIX \
 		".section .smp_locks,\"a\"\n"	\
-		_ASM_ALIGN "\n"			\
-		_ASM_PTR "661f\n" /* address */	\
+		".balign 4\n"			\
+		".long 661f - .\n" /* offset */	\
 		".previous\n"			\
 		"661:\n\tlock; "
 
arch/x86/kernel/alternative.c +25 -20

93 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Jan Beulich

... by using relative pointers instead of absolute ones, thus cutting the table size by half.

We probably could use something like this for the alternatives and exceptions tables, too...

-hpa

#2 lore raw

[tip:x86/asm] x86-64: Reduce SMP locks table size

In reply to Jan Beulich
Commit-ID:  5967ed87ade85a421ef814296c3c7f182b08c225
Gitweb:     http://git.kernel.org/tip/5967ed87ade85a421ef814296c3c7f182b08c225
Author:     Jan Beulich <[email protected]>
AuthorDate: Wed, 21 Apr 2010 16:08:14 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Wed, 28 Apr 2010 17:15:47 -0700

x86-64: Reduce SMP locks table size

Reduce the SMP locks table size by using relative pointers instead of absolute ones, thus cutting the table size by half.

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/alternative-asm.h |    4 +-
 arch/x86/include/asm/alternative.h     |    4 +-
 arch/x86/kernel/alternative.c          |   45 +++++++++++++++++--------------
 3 files changed, 29 insertions(+), 24 deletions(-)
arch/x86/include/asm/alternative-asm.h +2 -2
index b97f786..a63a68b 100644
@@ -6,8 +6,8 @@
 	.macro LOCK_PREFIX
 1:	lock
 	.section .smp_locks,"a"
-	_ASM_ALIGN
-	_ASM_PTR 1b
+	.balign 4
+	.long 1b - .
 	.previous
 	.endm
 #else
arch/x86/include/asm/alternative.h +2 -2
index b09ec55..714bf24 100644
@@ -30,8 +30,8 @@
 #ifdef CONFIG_SMP
 #define LOCK_PREFIX \
 		".section .smp_locks,\"a\"\n"	\
-		_ASM_ALIGN "\n"			\
-		_ASM_PTR "661f\n" /* address */	\
+		".balign 4\n"			\
+		".long 661f - .\n" /* offset */	\
 		".previous\n"			\
 		"661:\n\tlock; "
 
arch/x86/kernel/alternative.c +25 -20

93 lines not on this page · raw message