patched top(1) and kernel to support multiple CPU
前几天有人问FreeBSD的top(1)如何能够显示不同CPU的占用情况。这是patch过之后的输出:
|
FreeBSD 8中已经包含了这个功能。
共16篇文章。
前几天有人问FreeBSD的top(1)如何能够显示不同CPU的占用情况。这是patch过之后的输出:
|
FreeBSD 8中已经包含了这个功能。
📜 历史文件已不具备现实意义
本文记录了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.
对于MP内核来说,这是一项用于寻找内核中存在的性能弱点的重要工具。早先kris做的性能评估看来可以继续、常规化地做下去了。
离这个Q结束还有1个月,来总结一下:
工作:
开源软件方面的掺和:
David Xu’s two recent commits against -HEAD has finally fixed ULE on SMP, PREEMPTION and FULL_PREEMPTION case. Both his and my stress tests has proven that ULE is now rock solid again.
Now we will focus on solving other issues. Please be sure to test our next 6-STABLE snapshot and provide feedback, so we can make a great 6.0-RELEASE!
Finally we got ULE fixed! After some observation about stability this would definately be MFC’ed to RELENG_[56].
UPDATE: This is proven incomplete. We are still under investigation.
UPDATE: A subsequent commit of David Xu has finally got it fixed.
So now we have 6.0-BETA, 7.0-CURRENT, and both are frozen for bugfixes. I would struggle with the SMP ULE issue.
niklas has committed the final SMP branch code, no more SMP branchs, we have SMP in OpenBSD-CURRENT now!!
I’m going on to track down the Pentium 4 HTT issue of FreeBSD. Currently I have setup a tinderbox (hengdm’s workstation because he is not here :-P and it’s the only box which supports HTT) and compiled a SMP kernel on it.
Today I met a famous FreeBSD developer, David O’Brien (a.k.a. obrien@) and he gave us a presentation about the AMD64 architecture, which cleared my misunderstanding about the AMD64 architecture set by some marketing guys presenting in Tsinghua University.