diff options
author | julian <julian@FreeBSD.org> | 2006-12-06 06:34:57 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2006-12-06 06:34:57 +0000 |
commit | 396ed947f6606e1c43668a24471edd3bc2d2303a (patch) | |
tree | c0bf9a3a56052122c3c551fe189b4979f9bf745b /sys/kern/kern_proc.c | |
parent | a5878e15cf129593dc7e00da508adbbd01fd98f0 (diff) | |
download | FreeBSD-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_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2401b6b..0eb4407 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -141,9 +141,6 @@ proc_dtor(void *mem, int size, void *arg) { struct proc *p; struct thread *td; -#if defined(INVARIANTS) && defined(KSE) - struct ksegrp *kg; -#endif /* INVARIANTS checks go here */ p = (struct proc *)mem; @@ -151,14 +148,7 @@ proc_dtor(void *mem, int size, void *arg) #ifdef INVARIANTS KASSERT((p->p_numthreads == 1), ("bad number of threads in exiting process")); -#ifdef KSE - KASSERT((p->p_numksegrps == 1), ("free proc with > 1 ksegrp")); -#endif KASSERT((td != NULL), ("proc_dtor: bad thread pointer")); -#ifdef KSE - kg = FIRST_KSEGRP_IN_PROC(p); - KASSERT((kg != NULL), ("proc_dtor: bad kg pointer")); -#endif KASSERT(STAILQ_EMPTY(&p->p_ktr), ("proc_dtor: non-empty p_ktr")); #endif @@ -181,25 +171,15 @@ proc_init(void *mem, int size, int flags) { struct proc *p; struct thread *td; -#ifdef KSE - struct ksegrp *kg; -#endif p = (struct proc *)mem; p->p_sched = (struct p_sched *)&p[1]; td = thread_alloc(); -#ifdef KSE - kg = ksegrp_alloc(); -#endif bzero(&p->p_mtx, sizeof(struct mtx)); mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); p->p_stats = pstats_alloc(); -#ifdef KSE - proc_linkup(p, kg, td); - sched_newproc(p, kg, td); -#else proc_linkup(p, td); -#endif + sched_newproc(p, td); return (0); } @@ -215,9 +195,6 @@ proc_fini(void *mem, int size) p = (struct proc *)mem; pstats_free(p->p_stats); -#ifdef KSE - ksegrp_free(FIRST_KSEGRP_IN_PROC(p)); -#endif thread_free(FIRST_THREAD_IN_PROC(p)); mtx_destroy(&p->p_mtx); if (p->p_ksi != NULL) @@ -782,9 +759,6 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp) { -#ifdef KSE - struct ksegrp *kg; -#endif struct proc *p; p = td->td_proc; @@ -824,15 +798,6 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp) kp->ki_stat = SIDL; } -#ifdef KSE - kg = td->td_ksegrp; - - /* things in the KSE GROUP */ - kp->ki_estcpu = kg->kg_estcpu; - kp->ki_slptime = kg->kg_slptime; - kp->ki_pri.pri_user = kg->kg_user_pri; - kp->ki_pri.pri_class = kg->kg_pri_class; -#endif /* Things in the thread */ kp->ki_wchan = td->td_wchan; kp->ki_pri.pri_level = td->td_priority; @@ -845,12 +810,10 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp) kp->ki_pcb = td->td_pcb; kp->ki_kstack = (void *)td->td_kstack; kp->ki_pctcpu = sched_pctcpu(td); -#ifndef KSE kp->ki_estcpu = td->td_estcpu; kp->ki_slptime = td->td_slptime; kp->ki_pri.pri_class = td->td_pri_class; kp->ki_pri.pri_user = td->td_user_pri; -#endif /* We can't get this anymore but ps etc never used it anyway. */ kp->ki_rqindex = 0; |