Subject: re: schedcpu() raises interrupt level for too long
To: None <tech-kern@netbsd.org>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-kern
Date: 01/09/2003 17:53:08
Here's a revised patch that's better.
Index: kern_synch.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_synch.c,v
retrieving revision 1.119
diff -c -r1.119 kern_synch.c
*** kern_synch.c 2002/12/29 17:40:26 1.119
--- kern_synch.c 2003/01/09 16:50:10
***************
*** 248,254 ****
{
fixpt_t loadfac = loadfactor(averunnable.ldavg[0]);
struct proc *p;
! int s, s1;
unsigned int newcpu;
int clkhz;
--- 248,254 ----
{
fixpt_t loadfac = loadfactor(averunnable.ldavg[0]);
struct proc *p;
! int s;
unsigned int newcpu;
int clkhz;
***************
*** 286,292 ****
p->p_cpticks = 0;
newcpu = (u_int)decay_cpu(loadfac, p->p_estcpu);
p->p_estcpu = newcpu;
! SCHED_LOCK(s1);
resetpriority(p);
if (p->p_priority >= PUSER) {
if (p->p_stat == SRUN &&
--- 286,293 ----
p->p_cpticks = 0;
newcpu = (u_int)decay_cpu(loadfac, p->p_estcpu);
p->p_estcpu = newcpu;
! splx(s); /* Done with the process CPU ticks update */
! SCHED_LOCK(s);
resetpriority(p);
if (p->p_priority >= PUSER) {
if (p->p_stat == SRUN &&
***************
*** 298,305 ****
} else
p->p_priority = p->p_usrpri;
}
! SCHED_UNLOCK(s1);
! splx(s);
}
proclist_unlock_read();
uvm_meter();
--- 299,305 ----
} else
p->p_priority = p->p_usrpri;
}
! SCHED_UNLOCK(s);
}
proclist_unlock_read();
uvm_meter();