diff options
author | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2012-07-10 16:56:29 +0000 |
---|---|---|
committer | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2012-07-10 16:56:29 +0000 |
commit | d95ad7dec649f71e96eefa72821ee653a6c8e8e3 (patch) | |
tree | 8d97ec390241091d2dfd2ae3a3173ed91347fd33 | |
parent | 91268fc0a0e643924b53fc0f3335588649a7a612 (diff) |
We should only call need_resched() if the priority is lower than the
priority of the current running process.
In amd64 a call to need_resched() sends an IPI to the other cpu.
This fixes aja@ problem where he would move the mouse and see 60000
IPIs being sent.
Thanks to mikeb@ for bringing that subject up tuesday.
Actually found this after inquiring guenther@ about some changes in
mi_switch().
ok guenther@ aja@
-rw-r--r-- | sys/kern/kern_synch.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index caa939353e7..c885f83aa36 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.102 2012/04/10 11:33:58 guenther Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.103 2012/07/10 16:56:28 haesbaert Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -378,7 +378,9 @@ wakeup_n(const volatile void *ident, int n) p->p_stat = SRUN; p->p_cpu = sched_choosecpu(p); setrunqueue(p); - need_resched(p->p_cpu); + if (p->p_priority < + p->p_cpu->ci_schedstate.spc_curpriority) + need_resched(p->p_cpu); /* END INLINE EXPANSION */ } |