From 422bb19d43b00d556ea2128df60a4911470b1791 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Tue, 14 Apr 2009 09:13:26 +0000 Subject: Some tweaks to the cpu affinity code. - Split up choosing of cpu between fork and "normal" cases. Fork is very different and should be treated as such. - Instead of implicitly choosing a cpu in setrunqueue, do it outside where it actually makes sense. - Just because a cpu is marked as idle doesn't mean it will be soon. There could be a thundering herd effect if we call wakeup from an interrupt handler, so subtract cpus with queued processes when deciding which cpu is actually idle. - some simplifications allowed by the above. kettenis@ ok (except one bugfix that was not in the intial diff) --- sys/kern/kern_synch.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'sys/kern/kern_synch.c') diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 449f93c7b5a..5d15d0e23a2 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.88 2009/03/23 13:25:11 art Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.89 2009/04/14 09:13:25 art Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -370,16 +370,7 @@ wakeup_n(void *ident, int n) updatepri(p); p->p_slptime = 0; p->p_stat = SRUN; - - /* - * Since curpriority is a user priority, - * p->p_priority is always better than - * curpriority on the last CPU on - * which it ran. - * - * XXXSMP See affinity comment in - * resched_proc(). - */ + p->p_cpu = sched_choosecpu(p); setrunqueue(p); need_resched(p->p_cpu); /* END INLINE EXPANSION */ -- cgit v1.2.3