sched_pin() bug in SCHED_ULE

Alan Cox alc at rice.edu
Wed Sep 1 17:20:07 UTC 2010


mdf at FreeBSD.org wrote:
[snip]
> I will test this patch out; thanks for the help!
>
> Two questions:
>
> 1) How does a thread get moved between CPUs when it's not running?  I
> see that we change the runqueue for non-running threads that are on a
> runqueue.  Does the code always check for THREAD_CAN_SCHED when adding
> a sleeping thread to a runqueue on wakeup?
>
> 2) I assume sched_switch() runs a lot more often than sched_pin() or
> sched_affinity(), so it would make sense to add any performance
> penalty of increased work in either of those places than in the
> scheduler.  I suppose the two memory references for THREAD_CAN_MIGRATE
> and THREAD_CAN_SCHED won't be that expensive.
>   

sched_pin() gets used a fair amount on i386 for creating temporary 
mappings in order to avoid the need for system-wide TLB shootdowns.  The 
use cases range from the fast path for pipes to page zeroing.

Alan



More information about the freebsd-current mailing list