Skip to contentSkip to conversation

x86: remove unused atomic_inc_short()

PATCH Superseded Dmitry Vyukov 2 participants 2 messages Mar 22, 2017 – Mar 27, 2017

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86: remove unused atomic_inc_short()

It is completely unused and implemented only on x86. Remove it.

Cc Andrey Ryabinin <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Andrew Morton <[email protected]>

---

Andrew, I think it needs to go into mm as the atomic-instrumented.h patch is in mm.

Changes since v1:
- change Suggested-by to Mark

---
 arch/tile/lib/atomic_asm_32.S             |  3 +--
 arch/x86/include/asm/atomic.h             | 13 -------------
 include/asm-generic/atomic-instrumented.h |  6 ------
 3 files changed, 1 insertion(+), 21 deletions(-)
arch/tile/lib/atomic_asm_32.S +1 -2
index 1a70e6c0f259..94709ab41ed8 100644
@@ -24,8 +24,7 @@
  * has an opportunity to return -EFAULT to the user if needed.
  * The 64-bit routines just return a "long long" with the value,
  * since they are only used from kernel space and don't expect to fault.
- * Support for 16-bit ops is included in the framework but we don't provide
- * any (x86_64 has an atomic_inc_short(), so we might want to some day).
+ * Support for 16-bit ops is included in the framework but we don't provide any.
  *
  * Note that the caller is advised to issue a suitable L1 or L2
  * prefetch on the address being manipulated to avoid extra stalls.
arch/x86/include/asm/atomic.h +0 -13
index 0cde164f058a..9ff8738103eb 100644
@@ -237,19 +237,6 @@ ATOMIC_OPS(xor, ^)
 
 int __arch_atomic_add_unless(atomic_t *v, int a, int u);
 
-/**
- * arch_atomic_inc_short - increment of a short integer
- * @v: pointer to type int
- *
- * Atomically adds 1 to @v
- * Returns the new value of @u
- */
-static __always_inline short int arch_atomic_inc_short(short int *v)
-{
-	asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
-	return *v;
-}
-
 #ifdef CONFIG_X86_32
 # include <asm/atomic64_32.h>
 #else
include/asm-generic/atomic-instrumented.h +0 -6
index 951bcd083925..70742da13087 100644
@@ -78,12 +78,6 @@ static __always_inline bool atomic64_add_unless(atomic64_t *v, long long a,
 	return arch_atomic64_add_unless(v, a, u);
 }
 
-static __always_inline short int atomic_inc_short(short int *v)
-{
-	kasan_check_write(v, sizeof(*v));
-	return arch_atomic_inc_short(v);
-}
-
 #define __INSTR_VOID1(op, sz)						\
 static __always_inline void atomic##sz##_##op(atomic##sz##_t *v)	\
 {									\
Signature · 1 line
2.12.1.500.gab5fba24ee-goog
#1 lore raw
Quoted 13 lines · Dmitry Vyukov

It is completely unused and implemented only on x86. Remove it.

Cc Andrey Ryabinin <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Andrew Morton <[email protected]>

This does not apply cleanly on top of the locking tree, probably because it's based on still non-final KASAN bits. Please submit a patch on top of the locking tree.

Thanks,

Ingo