#
b61ce5b0 |
| 17-Sep-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Move all of the PS_ flags into either p_flag or td_flags. - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some
- Move all of the PS_ flags into either p_flag or td_flags. - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM.
Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
show more ...
|
#
67e20930 |
| 20-Aug-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Improve runq_findbit_from() which is used by ULE's circular queue. Mask of the bits we want to ignore on the first pass rather than doing a linear scan. This puts us within a few instructio
- Improve runq_findbit_from() which is used by ULE's circular queue. Mask of the bits we want to ignore on the first pass rather than doing a linear scan. This puts us within a few instructions of the cost of runq_findbit() and removes this function from the top of profiling output for context switch heavy workloads.
Approved by: re
show more ...
|
#
413ea6f5 |
| 04-Aug-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Set SW_PREEMPT when we preempt in critical_exit().
Approved by: re
|
#
56696bd1 |
| 19-Jul-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Remove explicit references to sched_lock. A simpler assert will do.
Approved by: re
|
#
671f2709 |
| 12-Jun-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Garbage collect unused concurrency functions.
|
#
7b20fb19 |
| 05-Jun-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
Commit 1/14 of sched_lock decomposition. - Move all scheduler locking into the schedulers utilizing a technique similar to solaris's container locking. - A per-process spinlock is now used to pr
Commit 1/14 of sched_lock decomposition. - Move all scheduler locking into the schedulers utilizing a technique similar to solaris's container locking. - A per-process spinlock is now used to protect the queue of threads, thread count, suspension count, p_sflags, and other process related scheduling fields. - The new thread lock is actually a pointer to a spinlock for the container that the thread is currently owned by. The container may be a turnstile, sleepqueue, or run queue. - thread_lock() is now used to protect access to thread related scheduling fields. thread_unlock() unlocks the lock and thread_set_lock() implements the transition from one lock to another. - A new "blocked_lock" is used in cases where it is not safe to hold the actual thread's lock yet we must prevent access to the thread. - sched_throw() and sched_fork_exit() are introduced to allow the schedulers to fix-up locking at these points. - Add some minor infrastructure for optionally exporting scheduler statistics that were invaluable in solving performance problems with this patch. Generally these statistics allow you to differentiate between different causes of context switches.
Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
show more ...
|
#
ed0e8f2f |
| 08-Feb-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Change types for necent runq additions to u_char rather than int. - Fix these types in ULE as well. This fixes bugs in priority index calculations in certain edge cases. (int)-1 % 64 != (uint)
- Change types for necent runq additions to u_char rather than int. - Fix these types in ULE as well. This fixes bugs in priority index calculations in certain edge cases. (int)-1 % 64 != (uint)-1 % 64.
Reported by: kkenn using pho's stress2.
show more ...
|
#
f0393f06 |
| 23-Jan-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Remove setrunqueue and replace it with direct calls to sched_add(). setrunqueue() was mostly empty. The few asserts and thread state setting were moved to the individual schedulers. sched_a
- Remove setrunqueue and replace it with direct calls to sched_add(). setrunqueue() was mostly empty. The few asserts and thread state setting were moved to the individual schedulers. sched_add() was chosen to displace it for naming consistency reasons. - Remove adjustrunqueue, it was 4 lines of code that was ifdef'd to be different on all three schedulers where it was only called in one place each. - Remove the long ifdef'd out remrunqueue code. - Remove the now redundant ts_state. Inspect the thread state directly. - Don't set TSF_* flags from kern_switch.c, we were only doing this to support a feature in one scheduler. - Change sched_choose() to return a thread rather than a td_sched. Also, rely on the schedulers to return the idlethread. This simplifies the logic in choosethread(). Aside from the run queue links kern_switch.c mostly does not care about the contents of td_sched.
Discussed with: julian
- Move the idle thread loop into the per scheduler area. ULE wants to do something different from the other schedulers.
Suggested by: jhb
Tested on: x86/amd64 sched_{4BSD, ULE, CORE}.
show more ...
|
Revision tags: release/6.2.0_cvs, release/6.2.0 |
|
#
cd49bb70 |
| 04-Jan-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Don't pass a pointer into runq_choose_from(). The caller can adjust the index if it chooses to.
|
#
3fed7d23 |
| 04-Jan-2007 |
Jeff Roberson <jeff@FreeBSD.org> |
- Add three new functions to support circular run queues. - runq_add_pri allows the caller to position the thread at any rqindex regardless of priority. - runq_choose_from() chooses the lowest p
- Add three new functions to support circular run queues. - runq_add_pri allows the caller to position the thread at any rqindex regardless of priority. - runq_choose_from() chooses the lowest priority thread starting from a given index. The index is updated with the rqindex of the chosen thread. This routine is used to pick the lowest priority relative to a given index. - runq_remove_idx() updates the index if the run queue that held the removed thread is now empty.
show more ...
|
#
2da78e38 |
| 31-Dec-2006 |
Robert Watson <rwatson@FreeBSD.org> |
Prefer a more traditional spelling of inhibited in comments and panic messages.
|
#
ad1e7d28 |
| 06-Dec-2006 |
Julian Elischer <julian@FreeBSD.org> |
Threading cleanup.. part 2 of several.
Make part of John Birrell's KSE patch permanent.. Specifically, remove: Any reference of the ksegrp structure. This feature was never fully utilised and made t
Threading cleanup.. part 2 of several.
Make part of John Birrell's KSE patch permanent.. Specifically, remove: Any reference of the ksegrp structure. This feature was never fully utilised and made things overly complicated. All code in the scheduler that tried to make threaded programs fair to unthreaded programs. Libpthread processes will already do this to some extent and libthr processes already disable it.
Also: Since this makes such a big change to the scheduler(s), take the opportunity to rename some structures and elements that had to be moved anyhow. This makes the code a lot more readable.
The ULE scheduler compiles again but I have no idea if it works.
The 4bsd scheduler still reqires a little cleaning and some functions that now do ALMOST nothing will go away, but I thought I'd do that as a separate commit.
Tested by David Xu, and Dan Eischen using libthr and libpthread.
show more ...
|
#
8460a577 |
| 26-Oct-2006 |
John Birrell <jb@FreeBSD.org> |
Make KSE a kernel option, turned on by default in all GENERIC kernel configs except sun4v (which doesn't process signals properly with KSE).
Reviewed by: davidxu@
|
#
b41f1452 |
| 13-Jun-2006 |
David Xu <davidxu@FreeBSD.org> |
Add scheduler CORE, the work I have done half a year ago, recent, I picked it up again. The scheduler is forked from ULE, but the algorithm to detect an interactive process is almost completely diffe
Add scheduler CORE, the work I have done half a year ago, recent, I picked it up again. The scheduler is forked from ULE, but the algorithm to detect an interactive process is almost completely different with ULE, it comes from Linux paper "Understanding the Linux 2.6.8.1 CPU Scheduler", although I still use same word "score" as a priority boost in ULE scheduler.
Briefly, the scheduler has following characteristic: 1. Timesharing process's nice value is seriously respected, timeslice and interaction detecting algorithm are based on nice value. 2. per-cpu scheduling queue and load balancing. 3. O(1) scheduling. 4. Some cpu affinity code in wakeup path. 5. Support POSIX SCHED_FIFO and SCHED_RR. Unlike scheduler 4BSD and ULE which using fuzzy RQ_PPQ, the scheduler uses 256 priority queues. Unlike ULE which using pull and push, the scheduelr uses pull method, the main reason is to let relative idle cpu do the work, but current the whole scheduler is protected by the big sched_lock, so the benefit is not visible, it really can be worse than nothing because all other cpu are locked out when we are doing balancing work, which the 4BSD scheduelr does not have this problem. The scheduler does not support hyperthreading very well, in fact, the scheduler does not make the difference between physical CPU and logical CPU, this should be improved in feature. The scheduler has priority inversion problem on MP machine, it is not good for realtime scheduling, it can cause realtime process starving. As a result, it seems the MySQL super-smack runs better on my Pentium-D machine when using libthr, despite on UP or SMP kernel.
show more ...
|
#
4bb0f51d |
| 02-Jun-2006 |
Olivier Houchard <cognet@FreeBSD.org> |
sched_rem() already sets ke->ke_state to KES_THREAD, so there's no need to redo it.
|
Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0 |
|
#
3f349776 |
| 28-Dec-2005 |
Alexander Kabaev <kan@FreeBSD.org> |
Trim trailing whitespace.
|
#
1335c4df |
| 18-Dec-2005 |
Nate Lawson <njl@FreeBSD.org> |
Restore KTR_CRITICAL but conditionally compile it in as KTR_SCHED.
Requested by: scottl, jhb
|
#
8615fd86 |
| 17-Dec-2005 |
Nate Lawson <njl@FreeBSD.org> |
Clean up unused or poorly utilized KTR values. Remove KTR_FS, KTR_KGDB, and KTR_IO as they were never used. Remove KTR_CLK since it was only used for hardclock firing and use KTR_INTR there instead
Clean up unused or poorly utilized KTR values. Remove KTR_FS, KTR_KGDB, and KTR_IO as they were never used. Remove KTR_CLK since it was only used for hardclock firing and use KTR_INTR there instead. Remove KTR_CRITICAL since it was only used for crit enter/exit and use KTR_CONTENTION instead.
show more ...
|
Revision tags: release/6.0.0_cvs, release/6.0.0 |
|
#
3c424d14 |
| 03-Aug-2005 |
David Xu <davidxu@FreeBSD.org> |
In adjustrunqueue(), add code to handle thread migrating case for ULE scheduler. In original code, local run queue of threaded ksegrp is corrupted if adjustrunqueue() is called while thread is migrat
In adjustrunqueue(), add code to handle thread migrating case for ULE scheduler. In original code, local run queue of threaded ksegrp is corrupted if adjustrunqueue() is called while thread is migrating.
show more ...
|
#
3ea6bbc5 |
| 10-Jun-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Restore preemption of idle threads.
Submitted by: jhb
|
#
a3f2d842 |
| 09-Jun-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Lots of whitespace cleanup. Fix for broken if condition.
Submitted by: nate@
|
#
f3a0f873 |
| 09-Jun-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Fix some race conditions for pinned threads that may cause them to run on the wrong CPU.
Add IPI support for preempting a thread on another CPU.
MFC after:3 weeks
|
#
d13ec713 |
| 24-May-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Use low level constructs borrowed from interrupt threads to wait for work in proc0. Remove the TDP_WAKEPROC0 workaround.
|
#
503c2ea3 |
| 19-May-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Fix a bug that caused preemption to happen for a thread in the same ksegrp with the same priority as the currently running thread. This can cause propagate_priority() to panic.
Pointy hat to: ups
|
Revision tags: release/5.4.0_cvs, release/5.4.0 |
|
#
77918643 |
| 08-Apr-2005 |
Stephan Uphoff <ups@FreeBSD.org> |
Sprinkle some volatile magic and rearrange things a bit to avoid race conditions in critical_exit now that it no longer blocks interrupts.
Reviewed by: jhb
|