SMP and setrunnable()- scheduler 4bsd

Terry Lambert tlambert2 at
Wed Jul 9 00:43:43 PDT 2003

Andy Farkas wrote:
> On Tue, 8 Jul 2003, Julian Elischer wrote:
> > It looks tp me that if we make a thread runnable
> > and there is a processor in the idle loop, the idle processor should be
> > kicked in some way to make it go get the newly runnable thread.
> Is this what's happenning to me an my setiathomes?

The command:

	sysctl machdep.cpu_idle_hlt

will tell you.  If it says 1, then it may be the problem.  If it
says 0, then it's not the problem.  You can explicitly set it to
zero to disable halting in the idle loop.  If you do this, your
machine is likely to run ~20% hotter (depending on the CPU type),
since HLT'ing an idle CPU tends to cool it off.

If this fixes your problem, then it's likely that what's happening
is that one or more of your CPU's are being idled until the clock
or some other interrupt fires, at which point in time your setiathome
processes are probably not the highest priority, as other things with
higher priority have gotten in the run queue ahead of them.

If this is the case, then Julian's suggested fix of an IPI to one or
more idle CPU's when a process becomes ready-to-run will most likely
be necessary to avoid this situation.

If it doesn't "fix" your problem, then it's obviously something
else... 8-).

-- Terry

More information about the freebsd-current mailing list