diff options
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 11 | ||||
-rw-r--r-- | sys/i386/i386/mp_machdep.c | 8 | ||||
-rw-r--r-- | sys/sun4v/sun4v/mp_machdep.c | 9 |
3 files changed, 4 insertions, 24 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 83eab2e..bafd4fc 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -950,15 +950,8 @@ ipi_bitmap_handler(struct trapframe frame) ipi_bitmap = atomic_readandclear_int(&cpu_ipi_pending[cpu]); - if (ipi_bitmap & (1 << IPI_PREEMPT)) { - struct thread *running_thread = curthread; - thread_lock(running_thread); - if (running_thread->td_critnest > 1) - running_thread->td_owepreempt = 1; - else - mi_switch(SW_INVOL | SW_PREEMPT, NULL); - thread_unlock(running_thread); - } + if (ipi_bitmap & (1 << IPI_PREEMPT)) + sched_preempt(curthread); /* Nothing to do for AST */ } diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 85d25a5..468e772 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -1132,16 +1132,10 @@ ipi_bitmap_handler(struct trapframe frame) ipi_bitmap = atomic_readandclear_int(&cpu_ipi_pending[cpu]); if (ipi_bitmap & (1 << IPI_PREEMPT)) { - struct thread *running_thread = curthread; #ifdef COUNT_IPIS (*ipi_preempt_counts[cpu])++; #endif - thread_lock(running_thread); - if (running_thread->td_critnest > 1) - running_thread->td_owepreempt = 1; - else - mi_switch(SW_INVOL | SW_PREEMPT, NULL); - thread_unlock(running_thread); + sched_preempt(curthread); } if (ipi_bitmap & (1 << IPI_AST)) { diff --git a/sys/sun4v/sun4v/mp_machdep.c b/sys/sun4v/sun4v/mp_machdep.c index e59679a..8bd4ba6 100644 --- a/sys/sun4v/sun4v/mp_machdep.c +++ b/sys/sun4v/sun4v/mp_machdep.c @@ -461,14 +461,7 @@ cpu_ipi_stop(struct trapframe *tf) void cpu_ipi_preempt(struct trapframe *tf) { - struct thread *running_thread = curthread; - - thread_lock(running_thread); - if (running_thread->td_critnest > 1) - running_thread->td_owepreempt = 1; - else - mi_switch(SW_INVOL | SW_PREEMPT, NULL); - thread_unlock(running_thread); + sched_preempt(curthread); } void |