lkml.org 
[lkml]   [2021]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v3] locking/atomic: Implement atomic{,64,_long}_{fetch_,}{andnot_or}{,_relaxed,_acquire,_release}()
On Thu, Jul 29, 2021 at 05:30:03PM +0800, Rui Wang wrote:
> This patch introduce a new atomic primitive andnot_or:
>
> * atomic_andnot_or
> * atomic_fetch_andnot_or
> * atomic_fetch_andnot_or_relaxed
> * atomic_fetch_andnot_or_acquire
> * atomic_fetch_andnot_or_release
> * atomic64_andnot_or
> * atomic64_fetch_andnot_or
> * atomic64_fetch_andnot_or_relaxed
> * atomic64_fetch_andnot_or_acquire
> * atomic64_fetch_andnot_or_release
> * atomic_long_andnot_or
> * atomic_long_fetch_andnot_or
> * atomic_long_fetch_andnot_or_relaxed
> * atomic_long_fetch_andnot_or_acquire
> * atomic_long_fetch_andnot_or_release
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Rui Wang <wangrui@loongson.cn>
> ---
> include/asm-generic/atomic-instrumented.h | 72 +++++-
> include/asm-generic/atomic-long.h | 62 ++++-
> include/linux/atomic-arch-fallback.h | 262 +++++++++++++++++++++-
> lib/atomic64_test.c | 92 ++++----
> scripts/atomic/atomics.tbl | 1 +
> scripts/atomic/fallbacks/andnot_or | 25 +++
> 6 files changed, 471 insertions(+), 43 deletions(-)
> create mode 100755 scripts/atomic/fallbacks/andnot_or

Please see my other comments on the other patches you posted:

https://lore.kernel.org/r/20210729093923.GD21151@willie-the-truck

Overall, I'm not thrilled to bits by extending the atomics API with
operations that cannot be implemented efficiently on any (?) architectures
and are only used by the qspinlock slowpath on machines with more than 16K
CPUs.

I also think we're lacking documentation justifying when you would use this
new primitive over e.g. a sub-word WRITE_ONCE() on architectures that
support those, especially for the non-returning variants.

Will

\
 
 \ /
  Last update: 2021-07-29 11:56    [W:0.104 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site