From 396ed947f6606e1c43668a24471edd3bc2d2303a Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 6 Dec 2006 06:34:57 +0000 Subject: 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. --- sys/kern/kern_thr.c | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'sys/kern/kern_thr.c') 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); -- cgit v1.1