summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-09-05 02:09:54 +0000
committerjulian <julian@FreeBSD.org>2004-09-05 02:09:54 +0000
commit5813d2702971c0732a69541a73be8c44114dd183 (patch)
tree18da20638d66699090b682ef6c65384dc44ef3e3 /sys/kern/kern_exit.c
parent6f864d0a973a7f3987d73132be311b7cfbd1ccfc (diff)
downloadFreeBSD-src-5813d2702971c0732a69541a73be8c44114dd183.zip
FreeBSD-src-5813d2702971c0732a69541a73be8c44114dd183.tar.gz
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
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 96e9cf2..747fb3b 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -134,7 +134,7 @@ exit1(struct thread *td, int rv)
* MUST abort all other threads before proceeding past here.
*/
PROC_LOCK(p);
- if (p->p_flag & P_SA || p->p_numthreads > 1) {
+ if (p->p_flag & P_HADTHREADS) {
retry:
/*
* First check if some other thread got here before us..
@@ -164,13 +164,8 @@ retry:
goto retry;
/*
* All other activity in this process is now stopped.
- * Remove excess KSEs and KSEGRPS. XXXKSE (when we have them)
- * ...
- * Turn off threading support.
+ * Threading support has been turned off.
*/
- p->p_flag &= ~P_SA;
- td->td_pflags &= ~TDP_SA;
- thread_single_end(); /* Don't need this any more. */
}
p->p_flag |= P_WEXIT;
@@ -385,16 +380,6 @@ retry:
lim_free(plim);
/*
- * Release this thread's reference to the ucred. The actual proc
- * reference will stay around until the proc is harvested by
- * wait(). At this point the ucred is immutable (no other threads
- * from this proc are around that can change it) so we leave the
- * per-thread ucred pointer intact in case it is needed although
- * in theory nothing should be using it at this point.
- */
- crfree(td->td_ucred);
-
- /*
* Remove proc from allproc queue and pidhash chain.
* Place onto zombproc. Unlink from parent's child list.
*/
OpenPOWER on IntegriCloud