mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[SPARC64]: Implement atomic backoff.
When the cpu count is high and contention hits an atomic object, the processors can synchronize such that some cpus continually get knocked out and cannot complete the atomic update. So implement an exponential backoff when SMP. Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
d85714d81c
commit
24f287e412
3 changed files with 76 additions and 20 deletions
28
include/asm-sparc64/backoff.h
Normal file
28
include/asm-sparc64/backoff.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef _SPARC64_BACKOFF_H
|
||||
#define _SPARC64_BACKOFF_H
|
||||
|
||||
#define BACKOFF_LIMIT (4 * 1024)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#define BACKOFF_SETUP(reg) \
|
||||
mov 1, reg
|
||||
|
||||
#define BACKOFF_SPIN(reg, tmp, label) \
|
||||
mov reg, tmp; \
|
||||
88: brnz,pt tmp, 88b; \
|
||||
sub tmp, 1, tmp; \
|
||||
cmp reg, BACKOFF_LIMIT; \
|
||||
bg,pn %xcc, label; \
|
||||
nop; \
|
||||
ba,pt %xcc, label; \
|
||||
sllx reg, 1, reg;
|
||||
|
||||
#else
|
||||
|
||||
#define BACKOFF_SETUP(reg)
|
||||
#define BACKOFF_SPIN(reg, tmp, label)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SPARC64_BACKOFF_H */
|
||||
Loading…
Reference in a new issue