couple of sched_ule issues

Jeff Roberson jroberson at
Thu Nov 3 20:43:46 UTC 2011

On Thu, 15 Sep 2011, Andriy Gapon wrote:

> This is more of a "just for the record" email.
> I think I've already stated the following observations, but I suspect that they
> drowned in the noise of a thread in which I mentioned them.
> 1. Incorrect topology is built for single-package SMP systems.
> That topology has two levels ("shared nothing" and "shared package") with exactly
> the same CPU sets.  That doesn't work well with the rebalancing algorithm which
> assumes that each level is a proper/strict subset of its parent.
> 2. CPU load comparison algorithms are biased towards lower logical CPU IDs.
> With all other things being equal the algorithms will always pick a CPU with a
> lower ID.  This creates certain load asymmetry and predictable patterns in load
> distribution.

If all other things truly are equal why does selecting a lower cpu number 

> Another observation.
> It seems that ULE makes a decision about thread-to-CPU affinity at the time when a
> thread gets switched out.  This looks logical from the implementation point of
> view.  But it doesn't seem logical from a general point of view - when the thread
> will be becoming running again its affinity profile may become completely
> different.  I think that it would depend on how much a thread actually spends not
> running.

The decision is made at sched_add() time.  sched_pickcpu() does the work 
and selects the run-queue we will be added to.  We consider the CPU that 
the thread was last running on but the decision is made at the time that a 
run queue must be selected.


> -- 
> Andriy Gapon
> _______________________________________________
> freebsd-current at mailing list
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at"

More information about the freebsd-current mailing list