mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions
@ 2026-10-26 11:18 Jerome Marchand
  2026-10-26 11:18 ` [PATCH 1/7] alpha: Remove the unused non-atomic local_t functions Jerome Marchand
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

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(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] alpha: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 2/7] loongarch: " Jerome Marchand
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 arch/alpha/include/asm/local.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/alpha/include/asm/local.h b/arch/alpha/include/asm/local.h
index 88eb398947a5b..1578c76adda62 100644
--- a/arch/alpha/include/asm/local.h
+++ b/arch/alpha/include/asm/local.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/7] loongarch: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
  2026-10-26 11:18 ` [PATCH 1/7] alpha: Remove the unused non-atomic local_t functions Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 3/7] mips: " Jerome Marchand
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 arch/loongarch/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/loongarch/include/asm/local.h b/arch/loongarch/include/asm/local.h
index 2d118b1a060e4..d649b9867ba25 100644
--- a/arch/loongarch/include/asm/local.h
+++ b/arch/loongarch/include/asm/local.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/7] mips: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
  2026-10-26 11:18 ` [PATCH 1/7] alpha: Remove the unused non-atomic local_t functions Jerome Marchand
  2026-10-26 11:18 ` [PATCH 2/7] loongarch: " Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 4/7] powerpc: " Jerome Marchand
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 arch/mips/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index 86fc240222425..c9381e5e3eff9 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/7] powerpc: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
                   ` (2 preceding siblings ...)
  2026-10-26 11:18 ` [PATCH 3/7] mips: " Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 5/7] x86: " Jerome Marchand
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 arch/powerpc/include/asm/local.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index 4c033526bfb0d..24ac534cf809a 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -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>
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/7] x86: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
                   ` (3 preceding siblings ...)
  2026-10-26 11:18 ` [PATCH 4/7] powerpc: " Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 6/7] asm-generic: " Jerome Marchand
  2026-10-26 11:18 ` [PATCH 7/7] asm-generic: Remove the unused non-atomic local64_t functions Jerome Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 arch/x86/include/asm/local.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index 68af7b74450af..6d0bca91915cd 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/7] asm-generic: Remove the unused non-atomic local_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
                   ` (4 preceding siblings ...)
  2026-10-26 11:18 ` [PATCH 5/7] x86: " Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  2026-10-26 11:18 ` [PATCH 7/7] asm-generic: Remove the unused non-atomic local64_t functions Jerome Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 include/asm-generic/local.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index 7f97018df66fe..4bb458b57d470 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 7/7] asm-generic: Remove the unused non-atomic local64_t functions
  2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
                   ` (5 preceding siblings ...)
  2026-10-26 11:18 ` [PATCH 6/7] asm-generic: " Jerome Marchand
@ 2026-10-26 11:18 ` Jerome Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: Jerome Marchand @ 2026-10-26 11:18 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm, Huacai Chen,
	WANG Xuerui, Thomas Bogendoerfer, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen
  Cc: linux-alpha, linux-kernel, loongarch, linux-mips, linuxppc-dev,
	linux-arch, 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.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 include/asm-generic/local64.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/asm-generic/local64.h b/include/asm-generic/local64.h
index 14963a7a62538..b30ae05f42b95 100644
--- a/include/asm-generic/local64.h
+++ b/include/asm-generic/local64.h
@@ -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 */
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-26 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 11:18 [PATCH 0/7] Remove the unused non-atomic local_t and local_64t functions Jerome Marchand
2026-10-26 11:18 ` [PATCH 1/7] alpha: Remove the unused non-atomic local_t functions Jerome Marchand
2026-10-26 11:18 ` [PATCH 2/7] loongarch: " Jerome Marchand
2026-10-26 11:18 ` [PATCH 3/7] mips: " Jerome Marchand
2026-10-26 11:18 ` [PATCH 4/7] powerpc: " Jerome Marchand
2026-10-26 11:18 ` [PATCH 5/7] x86: " Jerome Marchand
2026-10-26 11:18 ` [PATCH 6/7] asm-generic: " Jerome Marchand
2026-10-26 11:18 ` [PATCH 7/7] asm-generic: Remove the unused non-atomic local64_t functions Jerome Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®