Re: [PATCH v4 2/3] locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs

2019-02-20 Thread Will Deacon
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

2019-02-14 Thread Peter Zijlstra
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

2019-02-14 Thread Geert Uytterhoeven
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