Tuning the scheduler? Desktop with a CPU-intensive task becomes rapidly unusable.

Andriy Gapon avg at icyb.net.ua
Tue Sep 7 06:04:11 UTC 2010


on 07/09/2010 08:54 Jeremy Chadwick said the following:
> Can someone explain exactly what this sysctl does?  The description is
> only useful if you have familiarity with the scheduler internals:
> 
> $ sysctl -d kern.sched.preempt_thresh
> kern.sched.preempt_thresh: Min priority for preemption, lower priorities have greater precedence
> 
> The source code doesn't really explain it either -- but I will point out
> that there's a change in the default value based on an option called
> FULL_PREEMPTION:
> 
> src/sys/kern/sched_ule.c
>  192 #ifdef PREEMPTION
>  193 #ifdef FULL_PREEMPTION
>  194 static int preempt_thresh = PRI_MAX_IDLE;
>  195 #else
>  196 static int preempt_thresh = PRI_MIN_KERN;
>  197 #endif
>  198 #else
>  199 static int preempt_thresh = 0;
>  200 #endif
> 
> src/sys/sys/priority.h
>   81 #define PRI_MAX                 (255)           /* Lowest priority. */
>   97 #define PRI_MIN_KERN            (64)
>  ...
>  121 #define PRI_MAX_IDLE            (PRI_MAX)
> 

Well, I think you quoted almost all relevant source to get an understanding.
Take a look also at sched_shouldpreempt() in sched_ule.c.

-- 
Andriy Gapon


More information about the freebsd-stable mailing list