diff options
author | jhb <jhb@FreeBSD.org> | 2002-03-20 21:09:09 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-03-20 21:09:09 +0000 |
commit | 715dfdbcbe8ff5e275313a83ef7be76229d87ebf (patch) | |
tree | c0aa5a835f69a0ccf83503fd8b1f6284161207b7 /sys/powerpc | |
parent | 64bf9fe9fa4ffdff0c7bb06726e70267970c7f02 (diff) | |
download | FreeBSD-src-715dfdbcbe8ff5e275313a83ef7be76229d87ebf.zip FreeBSD-src-715dfdbcbe8ff5e275313a83ef7be76229d87ebf.tar.gz |
Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined.
Instead of caching the ucred reference, just go ahead and eat the
decerement and increment of the refcount. Now that Giant is pushed down
into crfree(), we no longer have to get Giant in the common case. In the
case when we are actually free'ing the ucred, we would normally free it on
the next kernel entry, so the cost there is not new, just in a different
place. This also removse td_cache_ucred from struct thread. This is
still only done #ifdef DIAGNOSTIC.
Tested on: i386, alpha
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/trap.c | 16 | ||||
-rw-r--r-- | sys/powerpc/powerpc/trap.c | 16 |
2 files changed, 6 insertions, 26 deletions
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c index 16ab7ae..6c122e6 100644 --- a/sys/powerpc/aim/trap.c +++ b/sys/powerpc/aim/trap.c @@ -226,13 +226,6 @@ trap(struct trapframe *frame) if (user) { sticks = td->td_kse->ke_sticks; td->td_frame = frame; -#ifdef DIAGNOSTIC - /* see the comment in ast() */ - if (td->td_ucred != NULL) - panic("trap(): thread got a ucred while in userspace"); - td->td_ucred = td->td_ucred_cache; - td->td_ucred_cache = NULL; -#endif if (td->td_ucred != p->p_ucred) cred_update_thread(td); @@ -303,12 +296,9 @@ trap(struct trapframe *frame) } userret(td, frame, sticks); mtx_assert(&Giant, MA_NOTOWNED); -#ifdef DIAGNOSTIC /* see the comment in ast() */ - if (td->td_ucred_cache) - panic("trap:thread already has cached ucred"); - td->td_ucred_cache = td->td_ucred; - td->td_ucred = NULL; -#endif /* DIAGNOSTIC */ +#ifdef DIAGNOSTIC + cred_free_thread(td); +#endif } void diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 16ab7ae..6c122e6 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -226,13 +226,6 @@ trap(struct trapframe *frame) if (user) { sticks = td->td_kse->ke_sticks; td->td_frame = frame; -#ifdef DIAGNOSTIC - /* see the comment in ast() */ - if (td->td_ucred != NULL) - panic("trap(): thread got a ucred while in userspace"); - td->td_ucred = td->td_ucred_cache; - td->td_ucred_cache = NULL; -#endif if (td->td_ucred != p->p_ucred) cred_update_thread(td); @@ -303,12 +296,9 @@ trap(struct trapframe *frame) } userret(td, frame, sticks); mtx_assert(&Giant, MA_NOTOWNED); -#ifdef DIAGNOSTIC /* see the comment in ast() */ - if (td->td_ucred_cache) - panic("trap:thread already has cached ucred"); - td->td_ucred_cache = td->td_ucred; - td->td_ucred = NULL; -#endif /* DIAGNOSTIC */ +#ifdef DIAGNOSTIC + cred_free_thread(td); +#endif } void |