From 128ae3c8d893885f814d7838d0d6b55e38ebd5a9 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 22 Apr 2003 20:54:04 +0000 Subject: - Move PS_PROFIL and its new cousin PS_STOPPROF back over to p_flag and rename them appropriately. Protect both flags with both the proc lock and the sched_lock. - Protect p_profthreads with the proc lock. - Remove Giant from profil(2). --- sys/kern/subr_trap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sys/kern/subr_trap.c') diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 74d8fd6..11e25e4 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -115,11 +115,8 @@ userret(td, frame, oticks) /* * Charge system time if profiling. - * - * XXX should move PS_PROFIL to a place that can obviously be - * accessed safely without sched_lock. */ - if (p->p_sflag & PS_PROFIL) { + if (p->p_flag & P_PROFIL) { quad_t ticks; mtx_lock_spin(&sched_lock); @@ -182,7 +179,7 @@ ast(struct trapframe *framep) TDF_NEEDRESCHED | TDF_OWEUPC); cnt.v_soft++; prticks = 0; - if (flags & TDF_OWEUPC && sflag & PS_PROFIL) { + if (flags & TDF_OWEUPC && p->p_flag & P_PROFIL) { prticks = p->p_stats->p_prof.pr_ticks; p->p_stats->p_prof.pr_ticks = 0; } @@ -197,7 +194,7 @@ ast(struct trapframe *framep) if (td->td_ucred != p->p_ucred) cred_update_thread(td); - if (flags & TDF_OWEUPC && sflag & PS_PROFIL) + if (flags & TDF_OWEUPC && p->p_flag & P_PROFIL) addupc_task(td, p->p_stats->p_prof.pr_addr, prticks); if (sflag & PS_ALRMPEND) { PROC_LOCK(p); -- cgit v1.1