#
a4dcb4f6 |
| 30-Nov-2006 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Only grab the sched_lock if we actually need to modify the thread priority.
During a buildworld only 2/3 of the calls to msleep actually changed the priority.
|
#
7ee07175 |
| 16-Nov-2006 |
Pawel Jakub Dawidek <pjd@FreeBSD.org> |
Change sleepq_add(9) argument from 'struct mtx *' to 'struct lock_object *', which allows to use it with different kinds of locks. For example it allows to implement Solaris conditions variables whic
Change sleepq_add(9) argument from 'struct mtx *' to 'struct lock_object *', which allows to use it with different kinds of locks. For example it allows to implement Solaris conditions variables which will be used in ZFS port on top of sx(9) locks.
Reviewed by: jhb
show more ...
|
#
7eefbf10 |
| 15-Nov-2006 |
John Baldwin <jhb@FreeBSD.org> |
Adjust assertions to allow for magical properties of the 'lbolt' wait channel for tsleep(): - Allow tsleep() on &lbolt without Giant with a timeout 0 since &lbolt has an implied timeout. - If &lbol
Adjust assertions to allow for magical properties of the 'lbolt' wait channel for tsleep(): - Allow tsleep() on &lbolt without Giant with a timeout 0 since &lbolt has an implied timeout. - If &lbolt is used with msleep() pass NULL to sleepq_add() for the lock object. Unlike other sleepq channels, &lbolt doesn't have an associated owning lock.
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@
|
#
7bb561fb |
| 15-Jun-2006 |
David Xu <davidxu@FreeBSD.org> |
Use scheduler API sched_relinquish() to implement yield() syscall.
|
#
3ce3f442 |
| 03-Jun-2006 |
John Baldwin <jhb@FreeBSD.org> |
In the case of reentering the debugger due to an attempt to perform a context switch while in the debugger, reenter the debugger sooner before performing any statistics updates.
|
Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0 |
|
#
0f180a7c |
| 17-Apr-2006 |
John Baldwin <jhb@FreeBSD.org> |
Change msleep() and tsleep() to not alter the calling thread's priority if the specified priority is zero. This avoids a race where the calling thread could read a snapshot of it's current priority,
Change msleep() and tsleep() to not alter the calling thread's priority if the specified priority is zero. This avoids a race where the calling thread could read a snapshot of it's current priority, then a different thread could change the first thread's priority, then the original thread would call sched_prio() inside msleep() undoing the change made by the second thread. I used a priority of zero as no thread that calls msleep() or tsleep() should be specifying a priority of zero anyway.
The various places that passed 'curthread->td_priority' or some variant as the priority now pass 0.
show more ...
|
#
c008d517 |
| 23-Feb-2006 |
David Xu <davidxu@FreeBSD.org> |
Fix a sleep queue race for KSE thread.
Reviewed by: jhb
|
#
daad1cd7 |
| 22-Feb-2006 |
John Baldwin <jhb@FreeBSD.org> |
Fixup some comments. Mutexes's are locked, not entered for several years now and msleep blocks threads rather than processes.
|
#
94f0972b |
| 16-Feb-2006 |
David Xu <davidxu@FreeBSD.org> |
Fix a long standing race between sleep queue and thread suspension code. When a thread A is going to sleep, it calls sleepq_catch_signals() to detect any pending signals or thread suspension request,
Fix a long standing race between sleep queue and thread suspension code. When a thread A is going to sleep, it calls sleepq_catch_signals() to detect any pending signals or thread suspension request, if nothing happens, it returns without holding process lock or scheduler lock, this opens a race window which allows thread B to come in and do process suspension work, however since A is still at running state, thread B can do nothing to A, thread A continues, and puts itself into actually sleeping state, but B has never seen it, and it sits there forever until B is woken up by other threads sometimes later(this can be very long delay or never happen). Fix this bug by forcing sleepq_catch_signals to return with scheduler lock held. Fix sleepq_abort() by passing it an interrupted code, previously, it worked as wakeup_one(), and the interruption can not be identified correctly by sleep queue code when the sleeping thread is resumed. Let thread_suspend_check() returns EINTR or ERESTART, so sleep queue no longer has to use SIGSTOP as a hack to build a return value.
Reviewed by: jhb MFC after: 1 week
show more ...
|
#
e8444a7e |
| 11-Feb-2006 |
Poul-Henning Kamp <phk@FreeBSD.org> |
CPU time accounting speedup (step 2)
Keep accounting time (in per-cpu) cputicks and the statistics counts in the thread and summarize into struct proc when at context switch.
Don't reach across CPU
CPU time accounting speedup (step 2)
Keep accounting time (in per-cpu) cputicks and the statistics counts in the thread and summarize into struct proc when at context switch.
Don't reach across CPUs in calcru().
Add code to calibrate the top speed of cpu_tickrate() for variable cpu_tick hardware (like TSC on power managed machines).
Don't enforce monotonicity (at least for now) in calcru. While the calibrated cpu_tickrate ramps up it may not be true.
Use 27MHz counter on i386/Geode.
Use TSC on amd64 & i386 if present.
Use tick counter on sparc64
show more ...
|
#
5b1a8eb3 |
| 07-Feb-2006 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Modify the way we account for CPU time spent (step 1)
Keep track of time spent by the cpu in various contexts in units of "cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t only when
Modify the way we account for CPU time spent (step 1)
Keep track of time spent by the cpu in various contexts in units of "cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t only when somebody wants to inspect the numbers.
For now "cputicks" are still derived from the current timecounter and therefore things should by definition remain sensible also on SMP machines. (The main reason for this first milestone commit is to verify that hypothesis.)
On slower machines, the avoided multiplications to normalize timestams at every context switch, comes out as a 5-7% better score on the unixbench/context1 microbenchmark. On more modern hardware no change in performance is seen.
show more ...
|
#
89631506 |
| 29-Dec-2005 |
John Baldwin <jhb@FreeBSD.org> |
patch(1) and I aren't friends today. Axe a duplicate copy of the msleep_spin() function definition.
Spotted by: pjd
|
#
0cb7e6ae |
| 29-Dec-2005 |
John Baldwin <jhb@FreeBSD.org> |
Add a new function msleep_spin() which is a slightly stripped down version of msleep(). msleep_spin() doesn't support changing the priority of the thread while it is asleep nor does it support inter
Add a new function msleep_spin() which is a slightly stripped down version of msleep(). msleep_spin() doesn't support changing the priority of the thread while it is asleep nor does it support interruptible sleeps (PCATCH) or the PDROP flag. It does support timeouts however. It differs from msleep() in that the passed in mutex is a spin mutex. This means one can use msleep_spin() and wakeup() with a spin mutex similar to msleep() and wakeup() with a regular mutex. Note that the spin mutex in question needs to come before sched_lock and the sleepq locks in lock order.
show more ...
|
#
ef627e7d |
| 28-Nov-2005 |
John Baldwin <jhb@FreeBSD.org> |
When checking to see if a process has exceeded its time limit, flag the process as over the limit when its time is >= to the limit rather than > the limit. Technically, if p->p_rux.rux_runtime.sec =
When checking to see if a process has exceeded its time limit, flag the process as over the limit when its time is >= to the limit rather than > the limit. Technically, if p->p_rux.rux_runtime.sec == p->p_pcpulimit and p->p_rux.rux_runtime.frac == 0, the process hasn't exceeded the limit yet. However, having the fraction exactly equal to 0 is rather rare, and it is not worth the overhead to handle that edge case. With just the > comparison, the process would have to exceed its limit by almost a second before it was killed.
PR: kern/83192 Submitted by: Maciej Zawadzinski mzawadzinski at gmail dot com Reviewed by: bde MFC after: 1 week
show more ...
|
Revision tags: release/6.0.0_cvs, release/6.0.0 |
|
#
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.
|
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
|
#
b80ed614 |
| 31-Mar-2005 |
John Baldwin <jhb@FreeBSD.org> |
Don't recursively panic when we call mi_switch() in a critical section, even though calling mi_switch() after a panic is likely a bug anyway as the recursive panic only serves to make things worse.
|
Revision tags: release/4.11.0_cvs, release/4.11.0 |
|
#
63710c4d |
| 30-Dec-2004 |
John Baldwin <jhb@FreeBSD.org> |
Stop explicitly touching td_base_pri outside of the scheduler and simply set a thread's priority via sched_prio() when that is the desired action. The schedulers will start managing td_base_pri inter
Stop explicitly touching td_base_pri outside of the scheduler and simply set a thread's priority via sched_prio() when that is the desired action. The schedulers will start managing td_base_pri internally shortly.
show more ...
|
#
85da7a56 |
| 26-Dec-2004 |
Jeff Roberson <jeff@FreeBSD.org> |
- Define KTR points for KTR_SCHED.
|
#
7d2eb68b |
| 27-Nov-2004 |
David Xu <davidxu@FreeBSD.org> |
Unlock mutex if PDROP was set by caller.
|
Revision tags: release/5.3.0_cvs, release/5.3.0 |
|
#
b96741f4 |
| 16-Oct-2004 |
Scott Long <scottl@FreeBSD.org> |
If a process needs to be swapped in, wakeup the swapper from within critical_exit as the process is getting scheduled to run. This is subotimal but for now avoid the LOR between the scheduler and th
If a process needs to be swapped in, wakeup the swapper from within critical_exit as the process is getting scheduled to run. This is subotimal but for now avoid the LOR between the scheduler and the sleepq systems. This is a 5.3 candidate.
Submitted by: davidxu MFC After: 3 days
show more ...
|
#
2ff0e645 |
| 12-Oct-2004 |
John Baldwin <jhb@FreeBSD.org> |
Refine the turnstile and sleep queue interfaces just a bit: - Add a new _lock() call to each API that locks the associated chain lock for a lock_object pointer or wait channel. The _lookup() funct
Refine the turnstile and sleep queue interfaces just a bit: - Add a new _lock() call to each API that locks the associated chain lock for a lock_object pointer or wait channel. The _lookup() functions now require that the chain lock be locked via _lock() when they are called. - Change sleepq_add(), turnstile_wait() and turnstile_claim() to lookup the associated queue structure internally via _lookup() rather than accepting a pointer from the caller. For turnstiles, this means that the actual lookup of the turnstile in the hash table is only done when the thread actually blocks rather than being done on each loop iteration in _mtx_lock_sleep(). For sleep queues, this means that sleepq_lookup() is no longer used outside of the sleep queue code except to implement an assertion in cv_destroy(). - Change sleepq_broadcast() and sleepq_signal() to require that the chain lock is already required. For condition variables, this lets the cv_broadcast() and cv_signal() functions lock the sleep queue chain lock while testing the waiters count. This means that the waiters count internal to condition variables is no longer protected by the interlock mutex and cv_broadcast() and cv_signal() now no longer require that the interlock be held when they are called. This lets consumers of condition variables drop the lock before waking other threads which can result in fewer context switches.
MFC after: 1 month
show more ...
|
#
78c85e8d |
| 05-Oct-2004 |
John Baldwin <jhb@FreeBSD.org> |
Rework how we store process times in the kernel such that we always store the raw values including for child process statistics and only compute the system and user timevals on demand.
- Fix the var
Rework how we store process times in the kernel such that we always store the raw values including for child process statistics and only compute the system and user timevals on demand.
- Fix the various kern_wait() syscall wrappers to only pass in a rusage pointer if they are going to use the result. - Add a kern_getrusage() function for the ABI syscalls to use so that they don't have to play stackgap games to call getrusage(). - Fix the svr4_sys_times() syscall to just call calcru() to calculate the times it needs rather than calling getrusage() twice with associated stackgap, etc. - Add a new rusage_ext structure to store raw time stats such as tick counts for user, system, and interrupt time as well as a bintime of the total runtime. A new p_rux field in struct proc replaces the same inline fields from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime). A new p_crux field in struct proc contains the "raw" child time usage statistics. ruadd() has been changed to handle adding the associated rusage_ext structures as well as the values in rusage. Effectively, the values in rusage_ext replace the ru_utime and ru_stime values in struct rusage. These two fields in struct rusage are no longer used in the kernel. - calcru() has been split into a static worker function calcru1() that calculates appropriate timevals for user and system time as well as updating the rux_[isu]u fields of a passed in rusage_ext structure. calcru() uses a copy of the process' p_rux structure to compute the timevals after updating the runtime appropriately if any of the threads in that process are currently executing. It also now only locks sched_lock internally while doing the rux_runtime fixup. calcru() now only requires the caller to hold the proc lock and calcru1() only requires the proc lock internally. calcru() also no longer allows callers to ask for an interrupt timeval since none of them actually did. - calcru() now correctly handles threads executing on other CPUs. - A new calccru() function computes the child system and user timevals by calling calcru1() on p_crux. Note that this means that any code that wants child times must now call this function rather than reading from p_cru directly. This function also requires the proc lock. - This finishes the locking for rusage and friends so some of the Giant locks in exit1() and kern_wait() are now gone. - The locking in ttyinfo() has been tweaked so that a shared lock of the proctree lock is used to protect the process group rather than the process group lock. By holding this lock until the end of the function we now ensure that the process/thread that we pick to dump info about will no longer vanish while we are trying to output its info to the console.
Submitted by: bde (mostly) MFC after: 1 month
show more ...
|
#
14f0e2e9 |
| 16-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
clean up thread runq accounting a bit.
MFC after: 3 days
|