summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-02-17 01:09:56 +0000
committerjulian <julian@FreeBSD.org>2002-02-17 01:09:56 +0000
commitabe785e035306225e97c6f57f5c2e4f6345f3b8d (patch)
tree3dd328b38aee15fdbfd88129f31df6365b57a0d8 /sys/kern/subr_trap.c
parent6308e9245c1de5e4199690f0516a64f552824f07 (diff)
downloadFreeBSD-src-abe785e035306225e97c6f57f5c2e4f6345f3b8d.zip
FreeBSD-src-abe785e035306225e97c6f57f5c2e4f6345f3b8d.tar.gz
If the credential on an incoming thread is correct, don't bother
reaquiring it. In the same vein, don't bother dropping the thread cred when goinf ot userland. We are guaranteed to nned it when we come back, (which we are guaranteed to do). Reviewed by: jhb@freebsd.org, bde@freebsd.org (slightly different version)
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 9c24e17..d599b91 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -161,9 +161,8 @@ ast(framep)
p->p_stats->p_prof.pr_ticks = 0;
}
mtx_unlock_spin(&sched_lock);
- PROC_LOCK(p);
- td->td_ucred = crhold(p->p_ucred);
- PROC_UNLOCK(p);
+ if (td->td_ucred != p->p_ucred)
+ cred_update_thread(td);
if (flags & KEF_OWEUPC && sflag & PS_PROFIL)
addupc_task(ke, p->p_stats->p_prof.pr_addr, prticks);
if (sflag & PS_ALRMPEND) {
@@ -188,10 +187,12 @@ ast(framep)
}
userret(td, framep, sticks);
+#ifdef INVARIANTS
mtx_lock(&Giant);
crfree(td->td_ucred);
mtx_unlock(&Giant);
td->td_ucred = NULL;
+#endif
s = cpu_critical_enter();
}
mtx_assert(&Giant, MA_NOTOWNED);
OpenPOWER on IntegriCloud