- Rather than repeating the same preemption code everywhere call the scheduler
specific sched_preempt() routine.
This commit is contained in:
parent
ff256d9c47
commit
32c9d3a767
@ -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 */
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user