Skip to content

Allow inlined spinlocks again V3

Heiko Carstens linux-arch 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3spinlock: move spinlock function bodies to header fileinclude/linux/spinlock.h include/linux/spinlock_api_smp.h kernel/spinlock.c+300 -1550 replies
2/3spinlock: allow inlined spinlocksinclude/linux/spinlock_api_smp.h kernel/spinlock.c lib/Kconfig.debug+53 -00 replies
3/3spinlock: allow inlined spinlocks on s390arch/s390/Kconfig+1 -00 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchArnd BergmannPeter Zijlstra
1/3A-b A-b
2/3A-b A-b
3/3A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/3] Allow inlined spinlocks again V3

Hi Andrew,

since there were no objections to this patch set, would you mind picking it up for -mm? The patches are against current Linus' git head but also apply on top of the latest mmotm patch set.

===

This patch set allows to have inlined spinlocks again.

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.
Dependent on CONFIG_SPINLOCK_INLINE generate out-of-line or inlined locking functions.

The patches should be self explaining.

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.