Skip to contentSkip to conversation

Remove the unused non-atomic local_t and local_64t functions

PATCH New Jerome Marchand 1 participant 8 messages Oct 26

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Remove the unused non-atomic local_t and local_64t functions

While working on a fix for a tracing soft lockup , it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

At any rate, they're not used now, so it's probably better to remove them.

The local64_t don't have broken arch specific versions, but aren't used either, so remove them too.

Jerome Marchand (7):
alpha: Remove the unused non-atomic local_t functions
loongarch: Remove the unused non-atomic local_t functions
mips: Remove the unused non-atomic local_t functions
powerpc: Remove the unused non-atomic local_t functions
x86: Remove the unused non-atomic local_t functions
asm-generic: Remove the unused non-atomic local_t functions
asm-generic: Remove the unused non-atomic local64_t functions

 arch/alpha/include/asm/local.h     |  6 ------
 arch/loongarch/include/asm/local.h | 10 ----------
 arch/mips/include/asm/local.h      | 10 ----------
 arch/powerpc/include/asm/local.h   | 10 ----------
 arch/x86/include/asm/local.h       |  9 ---------
 include/asm-generic/local.h        |  7 -------
 include/asm-generic/local64.h      | 14 --------------
 7 files changed, 66 deletions(-)
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/7 alpha: Remove the unused non-atomic local_t functions

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 arch/alpha/include/asm/local.h | 6 ------
 1 file changed, 6 deletions(-)
arch/alpha/include/asm/local.h +0 -6
index 88eb398947a5b..1578c76adda62 100644
@@ -100,10 +100,4 @@ local_add_unless(local_t *l, long a, long u)
 
 #define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
 
-/* Verify if faster than atomic ops */
-#define __local_inc(l)		((l)->a.counter++)
-#define __local_dec(l)		((l)->a.counter++)
-#define __local_add(i,l)	((l)->a.counter+=(i))
-#define __local_sub(i,l)	((l)->a.counter-=(i))
-
 #endif /* _ALPHA_LOCAL_H */
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/7 loongarch: Remove the unused non-atomic local_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 arch/loongarch/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)
arch/loongarch/include/asm/local.h +0 -10
index 2d118b1a060e4..d649b9867ba25 100644
@@ -175,14 +175,4 @@ local_add_unless(local_t *l, long a, long u)
  */
 #define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
 
-/* Use these for per-cpu local_t variables: on some archs they are
- * much more efficient than these naive implementations.  Note they take
- * a variable, not an address.
- */
-
-#define __local_inc(l)		((l)->a.counter++)
-#define __local_dec(l)		((l)->a.counter++)
-#define __local_add(i, l)	((l)->a.counter += (i))
-#define __local_sub(i, l)	((l)->a.counter -= (i))
-
 #endif /* _ARCH_LOONGARCH_LOCAL_H */
Signature · 1 line
2.56.0
#3 lore raw

PATCH 3/7 mips: Remove the unused non-atomic local_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 arch/mips/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)
arch/mips/include/asm/local.h +0 -10
index 86fc240222425..c9381e5e3eff9 100644
@@ -176,14 +176,4 @@ local_add_unless(local_t *l, long a, long u)
  */
 #define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
 
-/* Use these for per-cpu local_t variables: on some archs they are
- * much more efficient than these naive implementations.  Note they take
- * a variable, not an address.
- */
-
-#define __local_inc(l)		((l)->a.counter++)
-#define __local_dec(l)		((l)->a.counter++)
-#define __local_add(i, l)	((l)->a.counter+=(i))
-#define __local_sub(i, l)	((l)->a.counter-=(i))
-
 #endif /* _ARCH_MIPS_LOCAL_H */
Signature · 1 line
2.56.0
#4 lore raw

PATCH 4/7 powerpc: Remove the unused non-atomic local_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 arch/powerpc/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)
arch/powerpc/include/asm/local.h +0 -10
index 4c033526bfb0d..24ac534cf809a 100644
@@ -140,16 +140,6 @@ static __inline__ bool local_add_unless(local_t *l, long a, long u)
 
 #define local_inc_not_zero(l)		local_add_unless((l), 1, 0)
 
-/* Use these for per-cpu local_t variables: on some archs they are
- * much more efficient than these naive implementations.  Note they take
- * a variable, not an address.
- */
-
-#define __local_inc(l)		((l)->v++)
-#define __local_dec(l)		((l)->v++)
-#define __local_add(i,l)	((l)->v+=(i))
-#define __local_sub(i,l)	((l)->v-=(i))
-
 #else /* CONFIG_PPC64 */
 
 #include <asm-generic/local.h>
Signature · 1 line
2.56.0
#5 lore raw

PATCH 5/7 x86: Remove the unused non-atomic local_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 arch/x86/include/asm/local.h | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/include/asm/local.h +0 -9
index 68af7b74450af..6d0bca91915cd 100644
@@ -170,13 +170,4 @@ local_add_unless(local_t *l, long a, long u)
 
 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
 
-/* On x86_32, these are no better than the atomic variants.
- * On x86-64 these are better than the atomic variants on SMP kernels
- * because they dont use a lock prefix.
- */
-#define __local_inc(l)		local_inc(l)
-#define __local_dec(l)		local_dec(l)
-#define __local_add(i, l)	local_add((i), (l))
-#define __local_sub(i, l)	local_sub((i), (l))
-
 #endif /* _ASM_X86_LOCAL_H */
Signature · 1 line
2.56.0
#6 lore raw

PATCH 6/7 asm-generic: Remove the unused non-atomic local_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

Anyway, they're not used now, so remove them.

---
 include/asm-generic/local.h | 7 -------
 1 file changed, 7 deletions(-)
include/asm-generic/local.h +0 -7
index 7f97018df66fe..4bb458b57d470 100644
@@ -47,11 +47,4 @@ typedef struct
 #define local_add_unless(l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))
 #define local_inc_not_zero(l) atomic_long_inc_not_zero(&(l)->a)
 
-/* Non-atomic variants, ie. preemption disabled and won't be touched
- * in interrupt, etc.  Some archs can optimize this case well. */
-#define __local_inc(l)		local_set((l), local_read(l) + 1)
-#define __local_dec(l)		local_set((l), local_read(l) - 1)
-#define __local_add(i,l)	local_set((l), local_read(l) + (i))
-#define __local_sub(i,l)	local_set((l), local_read(l) - (i))
-
 #endif /* _ASM_GENERIC_LOCAL_H */
Signature · 1 line
2.56.0
#7 lore raw

PATCH 7/7 asm-generic: Remove the unused non-atomic local64_t functions

In reply to Jerome Marchand

While working on a fix for a tracing soft lockup, it came to my attention that __local_dec() was broken on ppc64 and other arches (it actually increment the value). My first instinct was to fix it but the fact that this function was utterly broken for so long, decades for some arches makes me thing that those functions have not been used for a long time, if ever.

The local64_t non-atomic functions aren't used either, so remove them too.

---
 include/asm-generic/local64.h | 14 --------------
 1 file changed, 14 deletions(-)
include/asm-generic/local64.h +0 -14
index 14963a7a62538..b30ae05f42b95 100644
@@ -56,13 +56,6 @@ static inline bool local64_try_cmpxchg(local64_t *l, s64 *old, s64 new)
 #define local64_add_unless(l, _a, u) local_add_unless((&(l)->a), (_a), (u))
 #define local64_inc_not_zero(l)	local_inc_not_zero(&(l)->a)
 
-/* Non-atomic variants, ie. preemption disabled and won't be touched
- * in interrupt, etc.  Some archs can optimize this case well. */
-#define __local64_inc(l)	local64_set((l), local64_read(l) + 1)
-#define __local64_dec(l)	local64_set((l), local64_read(l) - 1)
-#define __local64_add(i,l)	local64_set((l), local64_read(l) + (i))
-#define __local64_sub(i,l)	local64_set((l), local64_read(l) - (i))
-
 #else /* BITS_PER_LONG != 64 */
 
 #include <linux/atomic.h>
@@ -95,13 +88,6 @@ typedef struct {
 #define local64_add_unless(l, _a, u) atomic64_add_unless((&(l)->a), (_a), (u))
 #define local64_inc_not_zero(l)	atomic64_inc_not_zero(&(l)->a)
 
-/* Non-atomic variants, ie. preemption disabled and won't be touched
- * in interrupt, etc.  Some archs can optimize this case well. */
-#define __local64_inc(l)	local64_set((l), local64_read(l) + 1)
-#define __local64_dec(l)	local64_set((l), local64_read(l) - 1)
-#define __local64_add(i,l)	local64_set((l), local64_read(l) + (i))
-#define __local64_sub(i,l)	local64_set((l), local64_read(l) - (i))
-
 #endif /* BITS_PER_LONG != 64 */
 
 #endif /* _ASM_GENERIC_LOCAL64_H */
Signature · 1 line
2.56.0