Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2002 11:29:15 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG
Subject:   Re: RE: that INVARIANT/ucred freeing stuff.
Message-ID:  <200202221929.g1MJTFI20465@apollo.backplane.com>
References:   <Pine.BSF.4.21.0202221109330.74100-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
    Sigh.  Well, if you really want.  I don't like the idea of
    the size of the thread structure changing just due to someone
    turning on or off DIAGNOSTIC though.

						-Matt

:OK here is my suggestion:
:
:We add extra code under DIAGNOSTIC
:the code does:
:
:in proc.h
:
:add a field to thread of:
:#ifdef DIAGNOSTIC
:	td_ucred_cache
:#endif /* DIAGNOSTIC */
:
:
:on texiting the kernel:
:
:#ifdef DIAGNOSTIC
:	if (td->td_ucred_cache)
:		panic("thread already has cached ucred");
:	td->td_ucred_cache = td->td_ucred;
:	td->td_ucred = NULL;
:#endif /* DIAGNOSTIC */
:
:
:on entering the kernel we do:
:
:
:#ifdef DIAGNOSTIC
:	if (td->td_ucred)
:		panic("thread got a cred form somewhere in userspace");
:	td->td_cred = td->td_ucred_cache;
:	td->td_ucred_cache = NULL;
:#endif /* DIAGNOSTIC */
:	if (td->ucred != p->p_ucred)
:		cred_update_thread(td);
:
:we get good performance even when it it is optionned in and 
:still have a NULL ucred pointer when in user space when DIAGNOSTIC
:is turned on. With no DIAGNOSTICS we get the best performance,
:and don't even bother to shift the reference.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202221929.g1MJTFI20465>