[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174436571713.31282.15659803490337622749.tip-bot2@tip-bot2>
Date: Fri, 11 Apr 2025 10:01:57 -0000
From: "tip-bot2 for Ingo Molnar" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>, Juergen Gross <jgross@...e.com>,
"H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject:
[tip: x86/alternatives] x86/alternatives: Simplify try_get_text_poke_array()
The following commit has been merged into the x86/alternatives branch of tip:
Commit-ID: b6a25841c171c42b02d316a6bf784fb32e39c786
Gitweb: https://git.kernel.org/tip/b6a25841c171c42b02d316a6bf784fb32e39c786
Author: Ingo Molnar <mingo@...nel.org>
AuthorDate: Fri, 11 Apr 2025 07:40:43 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Fri, 11 Apr 2025 11:01:34 +02:00
x86/alternatives: Simplify try_get_text_poke_array()
There's no need to return a pointer on success - it's always
the same pointer.
Return a bool instead.
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Juergen Gross <jgross@...e.com>
Cc: "H . Peter Anvin" <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: https://lore.kernel.org/r/20250411054105.2341982-32-mingo@kernel.org
---
arch/x86/kernel/alternative.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index f909f4e..edc18be 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2475,15 +2475,14 @@ static struct smp_text_poke_array {
static DEFINE_PER_CPU(atomic_t, text_poke_array_refs);
-static __always_inline
-struct smp_text_poke_array *try_get_text_poke_array(void)
+static __always_inline bool try_get_text_poke_array(void)
{
atomic_t *refs = this_cpu_ptr(&text_poke_array_refs);
if (!raw_atomic_inc_not_zero(refs))
- return NULL;
+ return false;
- return &text_poke_array;
+ return true;
}
static __always_inline void put_text_poke_array(void)
@@ -2530,9 +2529,9 @@ noinstr int smp_text_poke_int3_handler(struct pt_regs *regs)
*/
smp_rmb();
- desc = try_get_text_poke_array();
- if (!desc)
+ if (!try_get_text_poke_array())
return 0;
+ desc = &text_poke_array;
WARN_ON_ONCE(desc->vec != text_poke_array.vec);
Powered by blists - more mailing lists