Allow inlined spinlocks again V5
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 6 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | powerpc: rename __spin_try_lock() and friendsarch/ | +10 | 0 replies | |
| 2/8 | sparc: rename __spin_try_lock() and friendsarch/ arch/ | +20 | 1 reply | |
| 3/8 | m68k/asm-offsets: rename pt_regs offset definesarch/ arch/ arch/ +3 more | +53 | 0 replies | |
| 4/8 | m68k/asm-offsets: rename signal definesarch/ arch/ arch/ | +8 | 0 replies | |
| 5/8 | m68k: calculate thread_info offset with asm offsetarch/ arch/ | +15 | 0 replies | |
| 6/8 | spinlock: move spinlock function bodies to header fileinclude/ include/ kernel/ | +300 | 0 replies | |
| 7/8 | spinlock: allow inlined spinlocksinclude/ kernel/ | +175 | 0 replies | |
| 8/8 | spinlock: inline code for all locking variants on s390arch/ | +29 | 0 replies |
Reviews trailers per patch
2 of 8 patches have a Reviewed-by or Acked-by.
| Patch | Arnd Bergmann | Peter Zijlstra | David S. Miller |
|---|---|---|---|
| 1/8 | |||
| 2/8 | A-b | ||
| 3/8 | |||
| 4/8 | |||
| 5/8 | |||
| 6/8 | A-b | A-b | |
| 7/8 | |||
| 8/8 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [patch 0/8] Allow inlined spinlocks again V5
This patch set allows to have inlined spinlocks again.
V2: rewritten from scratch - now also with readable code
V3: removed macro to generate out-of-line spinlock variants since that
would break ctags. As requested by Arnd Bergmann.
V4: allow architectures to specify for each lock/unlock variant if
it should be kept out-of-line or inlined.
V5: simplify ifdefs as pointed out by Linus. Fix architecture compile
breakages caused by this change.
Linus, Ingo, do you still have objections?
---
The rationale behind this is that function calls on at least s390 are expensive.
If one considers that server kernels are usually compiled with !CONFIG_PREEMPT a simple spin_lock is just a compare and swap loop. The extra overhead for a function call is significant.
With inlined spinlocks overall cpu usage gets reduced by 1%-5% on s390. These numbers were taken with some network benchmarks. However I expect any workload that calls frequently into the kernel and which grabs a few locks to perform better.
The implementation is straight forward: move the function bodies of the locking functions to static inline functions and place them in a header file.
By default all locking code remains out-of-line. An architecture can specify
#define __spin_lock_is_small
in arch/<whatever>/include/asm/spinlock.h to force inlining of a locking function.
defconfig cross compile tested for alpha, arm, x86, x86_64, ia64, m68k, m68knommu, mips, powerpc, powerpc64, sparc64, s390, s390x.