summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2006-12-06 06:34:57 +0000
committerjulian <julian@FreeBSD.org>2006-12-06 06:34:57 +0000
commit396ed947f6606e1c43668a24471edd3bc2d2303a (patch)
treec0bf9a3a56052122c3c551fe189b4979f9bf745b /sys/kern/kern_thr.c
parenta5878e15cf129593dc7e00da508adbbd01fd98f0 (diff)
downloadFreeBSD-src-396ed947f6606e1c43668a24471edd3bc2d2303a.zip
FreeBSD-src-396ed947f6606e1c43668a24471edd3bc2d2303a.tar.gz
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.
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 37e3df2..2769f45 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -142,18 +142,12 @@ create_thread(struct thread *td, mcontext_t *ctx,
{
stack_t stack;
struct thread *newtd;
-#ifdef KSE
- struct ksegrp *kg, *newkg;
-#endif
struct proc *p;
long id;
int error;
error = 0;
p = td->td_proc;
-#ifdef KSE
- kg = td->td_ksegrp;
-#endif
/* Have race condition but it is cheap. */
if (p->p_numthreads >= max_threads_per_proc)
@@ -177,7 +171,7 @@ create_thread(struct thread *td, mcontext_t *ctx,
}
}
- /* Initialize our td and new ksegrp.. */
+ /* Initialize our td */
newtd = thread_alloc();
/*
@@ -229,50 +223,22 @@ create_thread(struct thread *td, mcontext_t *ctx,
}
}
-#ifdef KSE
- newkg = ksegrp_alloc();
- bzero(&newkg->kg_startzero,
- __rangeof(struct ksegrp, kg_startzero, kg_endzero));
- bcopy(&kg->kg_startcopy, &newkg->kg_startcopy,
- __rangeof(struct ksegrp, kg_startcopy, kg_endcopy));
- sched_init_concurrency(newkg);
PROC_LOCK(td->td_proc);
td->td_proc->p_flag |= P_HADTHREADS;
newtd->td_sigmask = td->td_sigmask;
mtx_lock_spin(&sched_lock);
- ksegrp_link(newkg, p);
- thread_link(newtd, newkg);
- PROC_UNLOCK(p);
-#else
- PROC_LOCK(td->td_proc);
- td->td_proc->p_flag |= P_HADTHREADS;
- newtd->td_sigmask = td->td_sigmask;
- mtx_lock_spin(&sched_lock);
thread_link(newtd, p);
PROC_UNLOCK(p);
-#endif
-#ifdef KSE
/* let the scheduler know about these things. */
- sched_fork_ksegrp(td, newkg);
sched_fork_thread(td, newtd);
if (rtp != NULL) {
- if (!(kg->kg_pri_class == PRI_TIMESHARE &&
- rtp->type == RTP_PRIO_NORMAL)) {
- rtp_to_pri(rtp, newkg);
- sched_prio(newtd, newkg->kg_user_pri);
- } /* ignore timesharing class */
- }
-#else
- sched_fork(td, newtd);
- if (rtp != NULL) {
if (!(td->td_pri_class == PRI_TIMESHARE &&
rtp->type == RTP_PRIO_NORMAL)) {
rtp_to_pri(rtp, newtd);
sched_prio(newtd, newtd->td_user_pri);
} /* ignore timesharing class */
}
-#endif
TD_SET_CAN_RUN(newtd);
/* if ((flags & THR_SUSPENDED) == 0) */
setrunqueue(newtd, SRQ_BORING);
OpenPOWER on IntegriCloud