Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2002 14:45:51 -0800 (PST)
From:      Julian Elischer <>
To:        Alfred Perlstein <>
Subject:   Re: ucred holding patch, BDE version
Message-ID:  <>
In-Reply-To: <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
In the current world, when the thread enters userland, it does:

lock giant
crfree() (which includes mutexes)
unlock giant

if there are ASTs it does this once again for each AST waiting as well.

And on the way into the system it does:
lock process
crhold() (which includes mutex ops)
unlock process

so if there is a single AST (not uncommon) it does on a system call, 4 to
6 locks and 4 to 6 unlocks just to get a reference on the ucred it already
had a reference on. By not freeing it when going to userland, and checking
if it is the right one when returning to the kernel, we replace that with
a pointer comparison (well maybe 2) 99.999% of the time.

John still wants to free it if INVARIANTS is on so he canh trap on
inapropriate access. I'm not sure it's needed but am willing to do so..

On Mon, 11 Feb 2002, Alfred Perlstein wrote:

> * Julian Elischer <> [020211 14:06] wrote:
> > here is the BDE version ready to commit.
> > Extended to other architectures.
> > 
> > Bruce, John, comments?
> > 
> > As I was adding a prototype to ucred.h I stripped the __Ps of the others in that
> > section
> > (in the spirit of "change it when editing it anyhow"
> I've been watching this patch fly back and forth several times now,
> my question is, what exactly is this supposed to protect us from
> and/or accomplish?
> -Alfred

To Unsubscribe: send mail to
with "unsubscribe freebsd-current" in the body of the message

Want to link to this message? Use this URL: <>