diff options
author | jhb <jhb@FreeBSD.org> | 2003-04-22 19:47:55 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-04-22 19:47:55 +0000 |
commit | cfedd4c7d621b4ce0f04cbf58a510ca40fd784b3 (patch) | |
tree | 86736ab0403a305470e891173b3cb475ebe05601 /sys/kern/kern_kse.c | |
parent | 1fb058ce86480fa03dbf80bce65350373f89dd34 (diff) | |
download | FreeBSD-src-cfedd4c7d621b4ce0f04cbf58a510ca40fd784b3.zip FreeBSD-src-cfedd4c7d621b4ce0f04cbf58a510ca40fd784b3.tar.gz |
- Mark the kse_purge_group() and kse_purge() definitions static to match
their prototypes.
- Remove sched_lock locking from kse_purge() as all callers already lock
the sched_lock before calling it.
- Hold the proc lock slightly longer to protect P_SHOULDSTOP().
Diffstat (limited to 'sys/kern/kern_kse.c')
-rw-r--r-- | sys/kern/kern_kse.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 6ccb19c..7dc177d 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1311,7 +1311,7 @@ thread_unlink(struct thread *td) * Purge a ksegrp resource. When a ksegrp is preparing to * exit, it calls this function. */ -void +static void kse_purge_group(struct thread *td) { struct ksegrp *kg; @@ -1336,14 +1336,13 @@ kse_purge_group(struct thread *td) * exit, it calls kse_purge to release any extra KSE resources in * the process. */ -void +static void kse_purge(struct proc *p, struct thread *td) { struct ksegrp *kg; struct kse *ke; KASSERT(p->p_numthreads == 1, ("bad thread number")); - mtx_lock_spin(&sched_lock); while ((kg = TAILQ_FIRST(&p->p_ksegrps)) != NULL) { TAILQ_REMOVE(&p->p_ksegrps, kg, kg_ksegrp); p->p_numksegrps--; @@ -1373,7 +1372,6 @@ kse_purge(struct proc *p, struct thread *td) } TAILQ_INSERT_HEAD(&p->p_ksegrps, td->td_ksegrp, kg_ksegrp); p->p_numksegrps++; - mtx_unlock_spin(&sched_lock); } /* @@ -1969,12 +1967,12 @@ thread_suspend_check(int return_instead) * and stays there. */ thread_suspend_one(td); - PROC_UNLOCK(p); if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount) { thread_unsuspend_one(p->p_singlethread); } } + PROC_UNLOCK(p); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); mtx_unlock_spin(&sched_lock); |