Subject: Re: 1.5ALPHA_2 i386 panic in suspendsched()
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-kern
Date: 09/20/2000 12:29:16
Manuel Bouyer <bouyer@antioche.lip6.fr> writes:
> > So, if (p_stat == SRUN && (p_flag & P_INMEM) != 0) then it's on run
> > queue, isn't it?
>
> I'm not sure it's always true.
I believe that's the way done in other place. Actually,
suspendsched() itself already implicitly relying on this. If not,
some process with p_stat == SSTOP may left on run queue. But
fortunately, penalty is just a redundant test.
> I looks safer to traverse the run queues. Anyway, as we're at
> shutdown time the time spent in suspendsched() isn't really a big
> issue.
It's not safe since not all runnable processes are on run queue and
swapper is still working, isn't it?
enami.
void
suspendsched()
{
struct proc *p;
int s;
/*
* Convert all non-P_SYSTEM SSLEEP or SRUN processes to SSTOP.
*/
proclist_lock_read();
SCHED_LOCK(s);
for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) {
if ((p->p_flag & P_SYSTEM) != 0)
continue;
switch (p->p_stat) {
case SRUN:
if ((p->p_flag & P_INMEM) != 0)
remrunqueue(p);
/* FALLTHROUGH */
case SSLEEP:
p->p_stat = SSTOP;
break;
case SONPROC:
/*
* XXX SMP: we need to deal with processes on
* others CPU !
*/
break;
default:
break;
}
}
SCHED_UNLOCK(s);
proclist_unlock_read();
}