Subject: Re: Small scheduler tweak for MP systems
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 01/14/2003 23:11:22
--2oS5YaxWCcQjTEyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Wed, Jan 15, 2003 at 10:27:24AM +0900, enami tsugutomo wrote:
> Is changing the test in resetpriority() from against p->p_usrpri to
> p->p_priority correct?
Good catch. I'll apply the following patch.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--2oS5YaxWCcQjTEyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=prio-patch
Index: kern_synch.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_synch.c,v
retrieving revision 1.120
diff -c -r1.120 kern_synch.c
*** kern_synch.c 2003/01/12 01:48:56 1.120
--- kern_synch.c 2003/01/15 07:10:12
***************
*** 920,926 ****
}
static __inline void
! resched_proc(struct proc *p)
{
struct cpu_info *ci;
--- 920,926 ----
}
static __inline void
! resched_proc(struct proc *p, u_char pri)
{
struct cpu_info *ci;
***************
*** 947,953 ****
* sched state, which we currently do not do.
*/
ci = (p->p_cpu != NULL) ? p->p_cpu : curcpu();
! if (p->p_priority < ci->ci_schedstate.spc_curpriority)
need_resched(ci);
}
--- 947,953 ----
* sched state, which we currently do not do.
*/
ci = (p->p_cpu != NULL) ? p->p_cpu : curcpu();
! if (pri < ci->ci_schedstate.spc_curpriority)
need_resched(ci);
}
***************
*** 996,1002 ****
if ((p->p_flag & P_INMEM) == 0)
sched_wakeup((caddr_t)&proc0);
else
! resched_proc(p);
}
/*
--- 996,1002 ----
if ((p->p_flag & P_INMEM) == 0)
sched_wakeup((caddr_t)&proc0);
else
! resched_proc(p, p->p_priority);
}
/*
***************
*** 1014,1020 ****
newpriority = PUSER + p->p_estcpu + NICE_WEIGHT * (p->p_nice - NZERO);
newpriority = min(newpriority, MAXPRI);
p->p_usrpri = newpriority;
! resched_proc(p);
}
/*
--- 1014,1020 ----
newpriority = PUSER + p->p_estcpu + NICE_WEIGHT * (p->p_nice - NZERO);
newpriority = min(newpriority, MAXPRI);
p->p_usrpri = newpriority;
! resched_proc(p, p->p_usrpri);
}
/*
--2oS5YaxWCcQjTEyO--