ULE 3.0
Jeff提交了ULE调度器的3.0版(sched,巧合?:)),这个版本对调度器本身的上锁进行了细化,从而带来了性能改善(最上面那根黄线,之前是下面那根青色的线)。
共7篇文章。
Jeff提交了ULE调度器的3.0版(sched,巧合?:)),这个版本对调度器本身的上锁进行了细化,从而带来了性能改善(最上面那根黄线,之前是下面那根青色的线)。
📜 历史文件已不具备现实意义
本文记录了2007年1月FreeBSD
-CURRENT合入ULE 2.0调度器时的情形,文中对 SCHED_ULE及sched_core的讨论仅反映当时的历史背景。
Today, Jeff Roberson has committed his version 2.0 ULE scheduler. This new version has addressed several design issues as well as several bugs.
The new scheduler has adopted a circular queue, instead of the double-queue structure which is also found in the Linux scheduler. The latter has lead to difficulty implementing nice correctly.
For uniprocessor case, ULE is now faster.
MP algorithm has been simplified a bit.
A lot of bugfixes, etc.
To quote the original commit message:
ULE 2.0:
- Remove the double queue mechanism for timeshare threads. It was slow due to excess cache lines in play, caused suboptimal scheduling behavior with niced and other non-interactive processes, complicated priority lending, etc.
- Use a circular queue with a floating starting index for timeshare threads. Enforces fairness by moving the insertion point closer to threads with worse priorities over time.
- Give interactive timeshare threads real-time user-space priorities and place them on the realtime/ithd queue.
- Select non-interactive timeshare thread priorities based on their cpu utilization over the last 10 seconds combined with the nice value. This gives us more sane priorities and behavior in a loaded system as compared to the old method of using the interactivity score. The interactive score quickly hit a ceiling if threads were non-interactive and penalized new hog threads.
- Use one slice size for all threads. The slice is not currently dynamically set to adjust scheduling behavior of different threads.
- Add some new sysctls for scheduling parameters.
Bug fixes/Clean up:
- Fix zeroing of
td_schedafter initialization inschedcaused by recent ksegrp removal._fork _thread() - Fix KSE interactivity issues related to frequent forking and exiting of kse threads. We simply disable the penalty for thread creation and exit for kse threads.
- Cleanup the cpu estimator by using tickincr here as well. Keep ticks and ltick/ftick in the same frequency. Previously ticks were stathz and others were hz.
- Lots of new and updated comments.
- Many many others.
Tested on: up x86/amd64, 8way amd64.
今天David Xu commit了他的新调度器(SCHED_CORE),这个调度器基于ULE调度器,但改变了一系列算法。打算抽时间好好看一看代码。
Now I got (partially) the point:
turnstile_waittd->td_sched->ke_runq is NULL (means that some part of the new thread is not initialized completely)Interestingly this does not happen in !PREEMPTION case.
Now my question are:
I have done several experiments/asserts to ensure that the panic is related to ULE+PREEMPTION case only.
My latest progress is that I found that sched_switch in ULE for the threaded case, can decide whether subsequent call would panic. Investigating.
You can obtain latest list from sys/sys/proc.h:
|
It seems that I have hit a bug, where kseq_nice_rem is being called too much. Have read the code and added some KASSERT/MPASS‘es.