1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
!
!
|
static void
idle_setup(void *dummy)
{
struct pcpu *pc;
struct proc *p;
struct thread *td;
int error;
p = NULL;
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
error = kproc_kthread_add(sched_idletd, NULL, &p, &td,
RFSTOPPED | RFHIGHPID, 0, "idle", "idle: cpu%d",
pc->pc_cpuid);
pc->pc_idlethread = td;
if (error)
panic("idle_setup: kproc_create error %d\n", error);
thread_lock(td);
TD_SET_CAN_RUN(td);
td->td_flags |= TDF_IDLETD | TDF_NOLOAD;
sched_class(td, PRI_IDLE);
sched_prio(td, PRI_MAX_IDLE);
thread_unlock(td);
}
}
|