summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2006-10-26 21:42:22 +0000
committerjb <jb@FreeBSD.org>2006-10-26 21:42:22 +0000
commitf82c7997354f95e680341bb8e10136ded5fd15eb (patch)
tree2136d90e7e60f4ef25fe147499787d0e6a155b82 /sys/kern/kern_thr.c
parentb3e38fbc69f126c6cc49a0a6e45096d6c01b7c43 (diff)
downloadFreeBSD-src-f82c7997354f95e680341bb8e10136ded5fd15eb.zip
FreeBSD-src-f82c7997354f95e680341bb8e10136ded5fd15eb.tar.gz
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@
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 7b65fbb..bfa1e2b 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -142,14 +142,18 @@ 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)
@@ -225,6 +229,7 @@ create_thread(struct thread *td, mcontext_t *ctx,
}
}
+#ifdef KSE
newkg = ksegrp_alloc();
bzero(&newkg->kg_startzero,
__rangeof(struct ksegrp, kg_startzero, kg_endzero));
@@ -238,7 +243,16 @@ create_thread(struct thread *td, mcontext_t *ctx,
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);
@@ -249,6 +263,16 @@ create_thread(struct thread *td, mcontext_t *ctx,
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