diff options
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 13 | ||||
-rw-r--r-- | sys/i386/i386/mp_machdep.c | 17 |
2 files changed, 12 insertions, 18 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d94cafb..074c754 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -949,15 +949,12 @@ 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; mtx_lock_spin(&sched_lock); - /* Don't preempt the idle thread */ - if (curthread != PCPU_GET(idlethread)) { - struct thread *running_thread = curthread; - if (running_thread->td_critnest > 1) - running_thread->td_owepreempt = 1; - else - mi_switch(SW_INVOL | SW_PREEMPT, NULL); - } + if (running_thread->td_critnest > 1) + running_thread->td_owepreempt = 1; + else + mi_switch(SW_INVOL | SW_PREEMPT, NULL); mtx_unlock_spin(&sched_lock); } diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 4cc5b73..859c482 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -1142,24 +1142,21 @@ 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]++; + (*ipi_preempt_counts[cpu])++; #endif mtx_lock_spin(&sched_lock); - /* Don't preempt the idle thread */ - if (curthread != PCPU_GET(idlethread)) { - struct thread *running_thread = curthread; - if (running_thread->td_critnest > 1) - running_thread->td_owepreempt = 1; - else - mi_switch(SW_INVOL | SW_PREEMPT, NULL); - } + if (running_thread->td_critnest > 1) + running_thread->td_owepreempt = 1; + else + mi_switch(SW_INVOL | SW_PREEMPT, NULL); mtx_unlock_spin(&sched_lock); } if (ipi_bitmap & (1 << IPI_AST)) { #ifdef COUNT_IPIS - *ipi_ast_counts[cpu]++; + (*ipi_ast_counts[cpu])++; #endif /* Nothing to do for AST */ } |