#
c6a37e84 |
| 04-Apr-2005 |
John Baldwin <jhb@FreeBSD.org> |
Divorce critical sections from spinlocks. Critical sections as denoted by critical_enter() and critical_exit() are now solely a mechanism for deferring kernel preemptions. They no longer have any a
Divorce critical sections from spinlocks. Critical sections as denoted by critical_enter() and critical_exit() are now solely a mechanism for deferring kernel preemptions. They no longer have any affect on interrupts. This means that standalone critical sections are now very cheap as they are simply unlocked integer increments and decrements for the common case.
Spin mutexes now use a separate KPI implemented in MD code: spinlock_enter() and spinlock_exit(). This KPI is responsible for providing whatever MD guarantees are needed to ensure that a thread holding a spin lock won't be preempted by any other code that will try to lock the same lock. For now all archs continue to block interrupts in a "spinlock section" as they did formerly in all critical sections. Note that I've also taken this opportunity to push a few things into MD code rather than MI. For example, critical_fork_exit() no longer exists. Instead, MD code ensures that new threads have the correct state when they are created. Also, we no longer try to fixup the idlethreads for APs in MI code. Instead, each arch sets the initial curthread and adjusts the state of the idle thread it borrows in order to perform the initial context switch.
This change is largely a big NOP, but the cleaner separation it provides will allow for more efficient alternative locking schemes in other parts of the kernel (bare critical sections rather than per-CPU spin mutexes for per-CPU data for example).
Reviewed by: grehan, cognet, arch@, others Tested on: i386, alpha, sparc64, powerpc, arm, possibly more
show more ...
|
#
6220dcba |
| 20-Mar-2005 |
Robert Watson <rwatson@FreeBSD.org> |
Add a read-only kern.sched.preemption sysctl so that user space can tell if "options PREEMPTION" is compiled into the kernel.
|
#
bc608306 |
| 17-Mar-2005 |
Robert Watson <rwatson@FreeBSD.org> |
A further step on the journey of meaking panics and debugging more reliable: in the window between the beginning of panic() and entering the debugger, it's possible to receive interrupts. If we rece
A further step on the journey of meaking panics and debugging more reliable: in the window between the beginning of panic() and entering the debugger, it's possible to receive interrupts. If we receive an interrupt, don't preempt if panicstr != NULL, as the system is in the process of failing, and the preempting thread is likely to stumble over the failure. The typical scenario is during the printf() in panic() prior to entering the debugger, but when running with a slower console type such as serial console.
It could be that the panic string should be passed to the debugger to print, so that it can run from the debugger's environment rather than a regular kernel printf.
Glanced at by: jhb
show more ...
|
Revision tags: release/4.11.0_cvs, release/4.11.0 |
|
#
9454b2d8 |
| 07-Jan-2005 |
Warner Losh <imp@FreeBSD.org> |
/* -> /*- for copyright notices, minor format tweaks as necessary
|
#
85da7a56 |
| 26-Dec-2004 |
Jeff Roberson <jeff@FreeBSD.org> |
- Define KTR points for KTR_SCHED.
|
#
7842f65e |
| 14-Dec-2004 |
Jeff Roberson <jeff@FreeBSD.org> |
- Garbage collect several unused members of struct kse and struce ksegrp. As best as I can tell, some of these were never used.
|
#
6db36923 |
| 21-Nov-2004 |
David Schultz <das@FreeBSD.org> |
Remove local definitions of RANGEOF() and use __rangeof() instead. Also remove a few bogus casts.
|
#
f42a43fa |
| 08-Nov-2004 |
Robert Watson <rwatson@FreeBSD.org> |
Add basic critical section tracing to KTR using event type KTR_CRITICAL. This generates a KTR event for each critical section entered and exited.
It would be desirable to also log the filename and l
Add basic critical section tracing to KTR using event type KTR_CRITICAL. This generates a KTR event for each critical section entered and exited.
It would be desirable to also log the filename and line number of the source entering or exiting the critical section, but this requires hacking up the critical section API, so I've not done that yet.
show more ...
|
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 ...
|
#
7c71b645 |
| 14-Oct-2004 |
Stephan Uphoff <ups@FreeBSD.org> |
Fix maybe_preempt_in_ksegrp for !SMP.
Tested by: tegge Reviewed by: julian Approved by: sam (mentor) MFC after: 3 days
|
#
13e7430f |
| 12-Oct-2004 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Make !SMP kernels compile, and as far as I can tell, work again.
|
#
84f9d4b1 |
| 12-Oct-2004 |
Stephan Uphoff <ups@FreeBSD.org> |
Prevent preemption in slot_fill. Implement preemption between threads in the same ksegp in out of slot situations to prevent priority inversion.
Tested by: pho Reviewed by: jhb, julian Approved by
Prevent preemption in slot_fill. Implement preemption between threads in the same ksegp in out of slot situations to prevent priority inversion.
Tested by: pho Reviewed by: jhb, julian Approved by: sam (mentor) MFC: ASAP
show more ...
|
#
042b7b1a |
| 10-Oct-2004 |
Julian Elischer <julian@FreeBSD.org> |
Don't release the slot twice.. sched_rem() has already done it.
Submitted by: stephan uphoff (ups at tree dot com) MFC after: 3 days
|
#
c20c691b |
| 06-Oct-2004 |
Julian Elischer <julian@FreeBSD.org> |
When preempting a thread, put it back on the HEAD of its run queue. (Only really implemented in 4bsd)
MFC after: 4 days
|
#
d39063f2 |
| 05-Oct-2004 |
Julian Elischer <julian@FreeBSD.org> |
Use some macros to trach available scheduler slots to allow easier debugging.
MFC after: 4 days
|
#
8daa8c60 |
| 19-Sep-2004 |
David Schultz <das@FreeBSD.org> |
The zone from which proc structures are allocated is marked UMA_ZONE_NOFREE to guarantee type stability, so proc_fini() should never be called. Move an assertion from proc_fini() to proc_dtor() and
The zone from which proc structures are allocated is marked UMA_ZONE_NOFREE to guarantee type stability, so proc_fini() should never be called. Move an assertion from proc_fini() to proc_dtor() and garbage-collect the rest of the unreachable code. I have retained vm_proc_dispose(), since I consider its disuse a bug.
show more ...
|
#
14f0e2e9 |
| 16-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
clean up thread runq accounting a bit.
MFC after: 3 days
|
#
9da3e923 |
| 16-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
e specific code to revert a partial add ot teh run queue, not remrunqueue() which can't handle a partially added thread.
MFC after: 1 week
|
#
e8807f22 |
| 15-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Oops accidentally removed #ifdef SCHED_4BSD as part of another commit This function is not yet used in ULE
|
#
1f9f5df6 |
| 14-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Commit a fix for some panics we've been seeing with preemption.
MFC after: 2 days
|
#
b2578c6c |
| 14-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Add some kasserts
|
#
3389af30 |
| 10-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Add some code to allow threads to nominat a sibling to run if theyu are going to sleep.
MFC after: 1 week
|
#
54983505 |
| 07-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Make debug printf less threatenning and make it only print out once.
MFC after: 2 days
|
#
6a574b2a |
| 06-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Don't do IPIs on behalf of interrupt threads. just punt straight on through to teh preemption code.
Make a KASSSERT out of a condition that can no longer occur. MFC after: 1 week
|
#
ed062c8d |
| 05-Sep-2004 |
Julian Elischer <julian@FreeBSD.org> |
Refactor a bunch of scheduler code to give basically the same behaviour but with slightly cleaned up interfaces.
The KSE structure has become the same as the "per thread scheduler private data" stru
Refactor a bunch of scheduler code to give basically the same behaviour but with slightly cleaned up interfaces.
The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time.
The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own.
Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens.
Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure.
The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring.
A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated.
Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can.
Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week
show more ...
|