diff options
author | jeff <jeff@FreeBSD.org> | 2008-03-10 01:32:48 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-03-10 01:32:48 +0000 |
commit | d952a04ecfe6f5305491292ff2c9c44059c51e82 (patch) | |
tree | daf5c735a933eb2c106e64a800d5762e72523038 /sys | |
parent | 7dc7c824eeadf8c9af5f349f380e2d273475383a (diff) | |
download | FreeBSD-src-d952a04ecfe6f5305491292ff2c9c44059c51e82.zip FreeBSD-src-d952a04ecfe6f5305491292ff2c9c44059c51e82.tar.gz |
- Rather than repeating the same preemption code everywhere call the scheduler
specific sched_preempt() routine.
Diffstat (limited to 'sys')
-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 |