MCPcopy Create free account
hub / github.com/F-Stack/f-stack / idle_setup

Function idle_setup

freebsd/kern/kern_idle.c:53–88  ·  view source on GitHub ↗

* Set up per-cpu idle process contexts. The AP's shouldn't be running or * accessing their idle processes at this point, so don't bother with * locking. */

Source from the content-addressed store, hash-verified

51 * locking.
52 */
53static void
54idle_setup(void *dummy)
55{
56#ifdef SMP
57 struct pcpu *pc;
58#endif
59 struct proc *p;
60 struct thread *td;
61 int error;
62
63 p = NULL; /* start with no idle process */
64#ifdef SMP
65 STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
66#endif
67#ifdef SMP
68 error = kproc_kthread_add(sched_idletd, NULL, &p, &td,
69 RFSTOPPED | RFHIGHPID, 0, "idle", "idle: cpu%d", pc->pc_cpuid);
70 pc->pc_idlethread = td;
71#else
72 error = kproc_kthread_add(sched_idletd, NULL, &p, &td,
73 RFSTOPPED | RFHIGHPID, 0, "idle", "idle");
74 PCPU_SET(idlethread, td);
75#endif
76 if (error)
77 panic("idle_setup: kproc_create error %d\n", error);
78
79 thread_lock(td);
80 TD_SET_CAN_RUN(td);
81 td->td_flags |= TDF_IDLETD | TDF_NOLOAD;
82 sched_class(td, PRI_IDLE);
83 sched_prio(td, PRI_MAX_IDLE);
84 thread_unlock(td);
85#ifdef SMP
86 }
87#endif
88}

Callers

nothing calls this directly

Calls 4

kproc_kthread_addFunction · 0.70
panicFunction · 0.70
sched_classFunction · 0.70
sched_prioFunction · 0.70

Tested by

no test coverage detected