* Nikolay Borisov <nik.borisov@xxxxxxxx> wrote:
I meant doing this:
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 5b1a6252a4b9..b6a781b9de26 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2587,12 +2587,16 @@ noinstr int smp_text_poke_int3_trap_handler(struct
pt_regs *regs)
* replacing opcode
* - SMP sync all CPUs
*/
-static void smp_text_poke_batch_process(void)
+void smp_text_poke_batch_finish(void)
{
unsigned char int3 = INT3_INSN_OPCODE;
unsigned int i;
int do_sync;
+
+ if (!text_poke_array.nr_entries)
+ return;
- smp_text_poke_batch_process();
+ smp_text_poke_batch_finish();
I suppose we could do this - it adds one more check to
smp_text_poke_batch_add() though.
> > Mind sending a patch? It does simplify the facility some more and that
AFAICS this doesn't change the semantics. I.e smp_text_poke_batch_add
will call poke_batch_finish iff the address to be added violates the
sorted order of text_poke_array. The net effect is we have 1 less
function name to care about.
Yeah, it doesn't change semantics, but it's a very small
deoptimization.
single branch will wash away against costs like the CR3 flushes done
...
Thanks,
Ingo