Re: [PATCH v4 2/3] locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs
On Wed, Feb 13, 2019 at 05:00:16PM -0500, Waiman Long wrote: > Currently, we have two different implementation of rwsem: > 1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c) > 2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c) > > As we are going to use a single generic implementation for rwsem-xadd.c > and no architecture-specific code will be needed, there is no point > in keeping two different implementations of rwsem. In most cases, the > performance of rwsem-spinlock.c will be worse. It also doesn't get all > the performance tuning and optimizations that had been implemented in > rwsem-xadd.c over the years. > > For simplication, we are going to remove rwsem-spinlock.c and make all > architectures use a single implementation of rwsem - rwsem-xadd.c. > > All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM > in the code are removed. > > Suggested-by: Peter Zijlstra > Signed-off-by: Waiman Long > --- > arch/alpha/Kconfig | 7 - > arch/arc/Kconfig| 3 - > arch/arm/Kconfig| 4 - > arch/arm64/Kconfig | 3 - > arch/c6x/Kconfig| 3 - > arch/csky/Kconfig | 3 - > arch/h8300/Kconfig | 3 - > arch/hexagon/Kconfig| 6 - > arch/ia64/Kconfig | 4 - > arch/m68k/Kconfig | 7 - > arch/microblaze/Kconfig | 6 - > arch/mips/Kconfig | 7 - > arch/nds32/Kconfig | 3 - > arch/nios2/Kconfig | 3 - > arch/openrisc/Kconfig | 6 - > arch/parisc/Kconfig | 6 - > arch/powerpc/Kconfig| 7 - > arch/riscv/Kconfig | 3 - > arch/s390/Kconfig | 6 - > arch/sh/Kconfig | 6 - > arch/sparc/Kconfig | 8 - > arch/unicore32/Kconfig | 6 - > arch/x86/Kconfig| 3 - > arch/x86/um/Kconfig | 6 - > arch/xtensa/Kconfig | 3 - > include/linux/rwsem-spinlock.h | 47 -- > include/linux/rwsem.h | 5 - > kernel/Kconfig.locks| 2 +- > kernel/locking/Makefile | 4 +- > kernel/locking/rwsem-spinlock.c | 339 > > kernel/locking/rwsem.h | 3 - > 31 files changed, 2 insertions(+), 520 deletions(-) > delete mode 100644 include/linux/rwsem-spinlock.h > delete mode 100644 kernel/locking/rwsem-spinlock.c Another nice cleanup, and it looks like the optimistic spinning in the xadd implementation is predicated on ARCH_SUPPORTS_ATOMIC_RMW, so we're all good there too. Acked-by: Will Deacon Will
Re: [PATCH v4 2/3] locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs
On Thu, Feb 14, 2019 at 11:54:47AM +0100, Geert Uytterhoeven wrote: > On Wed, Feb 13, 2019 at 11:01 PM Waiman Long wrote: > > Currently, we have two different implementation of rwsem: > > 1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c) > > 2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c) > > > > As we are going to use a single generic implementation for rwsem-xadd.c > > and no architecture-specific code will be needed, there is no point > > in keeping two different implementations of rwsem. In most cases, the > > performance of rwsem-spinlock.c will be worse. It also doesn't get all > > the performance tuning and optimizations that had been implemented in > > rwsem-xadd.c over the years. > > > > For simplication, we are going to remove rwsem-spinlock.c and make all > > architectures use a single implementation of rwsem - rwsem-xadd.c. > > > > All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM > > in the code are removed. > > > > Suggested-by: Peter Zijlstra > > Signed-off-by: Waiman Long > > Note that this conflicts with "[PATCH 03/11] kernel/locks: consolidate > RWSEM_GENERIC_* options" > https://lore.kernel.org/lkml/20190213174005.28785-4-...@lst.de/ *sigh*.. of that never was Cc'ed to locking people :/
Re: [PATCH v4 2/3] locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs
On Wed, Feb 13, 2019 at 11:01 PM Waiman Long wrote: > Currently, we have two different implementation of rwsem: > 1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c) > 2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c) > > As we are going to use a single generic implementation for rwsem-xadd.c > and no architecture-specific code will be needed, there is no point > in keeping two different implementations of rwsem. In most cases, the > performance of rwsem-spinlock.c will be worse. It also doesn't get all > the performance tuning and optimizations that had been implemented in > rwsem-xadd.c over the years. > > For simplication, we are going to remove rwsem-spinlock.c and make all > architectures use a single implementation of rwsem - rwsem-xadd.c. > > All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM > in the code are removed. > > Suggested-by: Peter Zijlstra > Signed-off-by: Waiman Long Note that this conflicts with "[PATCH 03/11] kernel/locks: consolidate RWSEM_GENERIC_* options" https://lore.kernel.org/lkml/20190213174005.28785-4-...@lst.de/ Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH v4 2/3] locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs
Currently, we have two different implementation of rwsem: 1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c) 2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c) As we are going to use a single generic implementation for rwsem-xadd.c and no architecture-specific code will be needed, there is no point in keeping two different implementations of rwsem. In most cases, the performance of rwsem-spinlock.c will be worse. It also doesn't get all the performance tuning and optimizations that had been implemented in rwsem-xadd.c over the years. For simplication, we are going to remove rwsem-spinlock.c and make all architectures use a single implementation of rwsem - rwsem-xadd.c. All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM in the code are removed. Suggested-by: Peter Zijlstra Signed-off-by: Waiman Long --- arch/alpha/Kconfig | 7 - arch/arc/Kconfig| 3 - arch/arm/Kconfig| 4 - arch/arm64/Kconfig | 3 - arch/c6x/Kconfig| 3 - arch/csky/Kconfig | 3 - arch/h8300/Kconfig | 3 - arch/hexagon/Kconfig| 6 - arch/ia64/Kconfig | 4 - arch/m68k/Kconfig | 7 - arch/microblaze/Kconfig | 6 - arch/mips/Kconfig | 7 - arch/nds32/Kconfig | 3 - arch/nios2/Kconfig | 3 - arch/openrisc/Kconfig | 6 - arch/parisc/Kconfig | 6 - arch/powerpc/Kconfig| 7 - arch/riscv/Kconfig | 3 - arch/s390/Kconfig | 6 - arch/sh/Kconfig | 6 - arch/sparc/Kconfig | 8 - arch/unicore32/Kconfig | 6 - arch/x86/Kconfig| 3 - arch/x86/um/Kconfig | 6 - arch/xtensa/Kconfig | 3 - include/linux/rwsem-spinlock.h | 47 -- include/linux/rwsem.h | 5 - kernel/Kconfig.locks| 2 +- kernel/locking/Makefile | 4 +- kernel/locking/rwsem-spinlock.c | 339 kernel/locking/rwsem.h | 3 - 31 files changed, 2 insertions(+), 520 deletions(-) delete mode 100644 include/linux/rwsem-spinlock.h delete mode 100644 kernel/locking/rwsem-spinlock.c diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 584a6e1..27c8712 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -49,13 +49,6 @@ config MMU bool default y -config RWSEM_GENERIC_SPINLOCK - bool - -config RWSEM_XCHGADD_ALGORITHM - bool - default y - config ARCH_HAS_ILOG2_U32 bool default n diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 376366a..c0dd229 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -63,9 +63,6 @@ config SCHED_OMIT_FRAME_POINTER config GENERIC_CSUM def_bool y -config RWSEM_GENERIC_SPINLOCK - def_bool y - config ARCH_DISCONTIGMEM_ENABLE def_bool n diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918..4d81f69 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -176,10 +176,6 @@ config TRACE_IRQFLAGS_SUPPORT bool default !CPU_V7M -config RWSEM_XCHGADD_ALGORITHM - bool - default y - config ARCH_HAS_ILOG2_U32 bool diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a4168d3..24bbcfa 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -238,9 +238,6 @@ config LOCKDEP_SUPPORT config TRACE_IRQFLAGS_SUPPORT def_bool y -config RWSEM_XCHGADD_ALGORITHM - def_bool y - config GENERIC_BUG def_bool y depends on BUG diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig index 456e154..f114655 100644 --- a/arch/c6x/Kconfig +++ b/arch/c6x/Kconfig @@ -26,9 +26,6 @@ config MMU config FPU def_bool n -config RWSEM_GENERIC_SPINLOCK - def_bool y - config GENERIC_CALIBRATE_DELAY def_bool y diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 398113c..90279a1 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -93,9 +93,6 @@ config GENERIC_HWEIGHT config MMU def_bool y -config RWSEM_GENERIC_SPINLOCK - def_bool y - config STACKTRACE_SUPPORT def_bool y diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 6472a06..ba33326 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -26,9 +26,6 @@ config H8300 config CPU_BIG_ENDIAN def_bool y -config RWSEM_GENERIC_SPINLOCK - def_bool y - config GENERIC_HWEIGHT def_bool y diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index fb2fbfc..5d07c8d 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -64,12 +64,6 @@ config GENERIC_CSUM config GENERIC_IRQ_PROBE def_bool y -config RWSEM_GENERIC_SPINLOCK - def_bool n - -config RWSEM_XCHGADD_ALGORITHM - def_bool y - config GENERIC_HWEIGHT def_bool y diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig