Date: Sat, 24 Apr 2010 02:32:02 +0200 From: Attilio Rao <attilio@freebsd.org> To: Matthew Fleming <matthew.fleming@isilon.com> Cc: FreeBSD-Hackers <freebsd-hackers@freebsd.org> Subject: Re: idle threads Message-ID: <j2t3bbf2fe11004231732s89bcd1beh68c05ccc032836c7@mail.gmail.com> In-Reply-To: <06D5F9F6F655AD4C92E28B662F7F853E039E34E1@seaxch09.desktop.isilon.com> References: <06D5F9F6F655AD4C92E28B662F7F853E039E34E1@seaxch09.desktop.isilon.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2010/4/24 Matthew Fleming <matthew.fleming@isilon.com>:
> I'm looking at kern_idle.c in stable/7 and I don't quite follow how idle
> threads work. The kthread_create(9) call does not pass in a function
> pointer, so what code does a processor run when there is no other
> runnable thread?
In STABLE_7:
...
#ifdef SMP
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
error = kthread_create(sched_idletd, NULL, &p,
RFSTOPPED | RFHIGHPID, 0, "idle: cpu%d", pc->pc_cpuid);
pc->pc_idlethread = FIRST_THREAD_IN_PROC(p);
#else
error = kthread_create(sched_idletd, NULL, &p,
RFSTOPPED | RFHIGHPID, 0, "idle");
PCPU_SET(idlethread, FIRST_THREAD_IN_PROC(p));
#endif
...
then they rightly passes sched_idletd(). Any scheduler may define its
own version of sched_idletd().
NULL is just the argument passed that is not meaningful.
Or maybe I'm not understanding your question?
Attilio
--
Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?j2t3bbf2fe11004231732s89bcd1beh68c05ccc032836c7>
