aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/lib/rwlock.S
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2011-07-19 08:00:45 -0400
committerIngo Molnar <mingo@elte.hu>2011-07-21 03:03:36 -0400
commita750036f35cda160ef77408ec92c3dc41f8feebb (patch)
tree1198013e1289dfb9b5a299388ee09515642c4030 /arch/x86/lib/rwlock.S
parenta738669464a1e0d8e7b20f631120192f9cf7cfbd (diff)
x86: Fix write lock scalability 64-bit issue
With the write lock path simply subtracting RW_LOCK_BIAS there is, on large systems, the theoretical possibility of overflowing the 32-bit value that was used so far (namely if 128 or more CPUs manage to do the subtraction, but don't get to do the inverse addition in the failure path quickly enough). A first measure is to modify RW_LOCK_BIAS itself - with the new value chosen, it is good for up to 2048 CPUs each allowed to nest over 2048 times on the read path without causing an issue. Quite possibly it would even be sufficient to adjust the bias a little further, assuming that allowing for significantly less nesting would suffice. However, as the original value chosen allowed for even more nesting levels, to support more than 2048 CPUs (possible currently only for 64-bit kernels) the lock itself gets widened to 64 bits. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/4E258E0D020000780004E3F0@nat28.tlf.novell.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/lib/rwlock.S')
-rw-r--r--arch/x86/lib/rwlock.S12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/lib/rwlock.S b/arch/x86/lib/rwlock.S
index fca17829caa8..1cad22139c88 100644
--- a/arch/x86/lib/rwlock.S
+++ b/arch/x86/lib/rwlock.S
@@ -15,12 +15,12 @@ ENTRY(__write_lock_failed)
15 CFI_STARTPROC 15 CFI_STARTPROC
16 FRAME 16 FRAME
170: LOCK_PREFIX 170: LOCK_PREFIX
18 addl $RW_LOCK_BIAS, (%__lock_ptr) 18 WRITE_LOCK_ADD($RW_LOCK_BIAS) (%__lock_ptr)
191: rep; nop 191: rep; nop
20 cmpl $RW_LOCK_BIAS, (%__lock_ptr) 20 cmpl $WRITE_LOCK_CMP, (%__lock_ptr)
21 jne 1b 21 jne 1b
22 LOCK_PREFIX 22 LOCK_PREFIX
23 subl $RW_LOCK_BIAS, (%__lock_ptr) 23 WRITE_LOCK_SUB($RW_LOCK_BIAS) (%__lock_ptr)
24 jnz 0b 24 jnz 0b
25 ENDFRAME 25 ENDFRAME
26 ret 26 ret
@@ -31,12 +31,12 @@ ENTRY(__read_lock_failed)
31 CFI_STARTPROC 31 CFI_STARTPROC
32 FRAME 32 FRAME
330: LOCK_PREFIX 330: LOCK_PREFIX
34 incl (%__lock_ptr) 34 READ_LOCK_SIZE(inc) (%__lock_ptr)
351: rep; nop 351: rep; nop
36 cmpl $1, (%__lock_ptr) 36 READ_LOCK_SIZE(cmp) $1, (%__lock_ptr)
37 js 1b 37 js 1b
38 LOCK_PREFIX 38 LOCK_PREFIX
39 decl (%__lock_ptr) 39 READ_LOCK_SIZE(dec) (%__lock_ptr)
40 js 0b 40 js 0b
41 ENDFRAME 41 ENDFRAME
42 ret 42 ret