Subject: Re: CVS commit: src/sys
To: None <ad@NetBSD.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 08/04/2006 07:51:06
> On Sat, Jul 22, 2006 at 03:36:08PM +0900, YAMAMOTO Takashi wrote:
> 
> > > Log Message:
> > > - Use the LWP cached credentials where sane.
> > > - Minor cosmetic changes.
> > 
> > how about using kauth_cred_get()?
> 
> Could you provide some context, please?

instead of "curlwp->l_cred".

> kauth_cred_get() embeds use of curlwp at a fairly low level. I can't come
> up with solid arguments against curlwp other than it could be slower than
> passing an lwp into a function as an argument, and it discourages caching
> the address locally. Anyone?

i'm not sure if this kind of micro-optimization makes much sense.
i'm not sure which of using curlwp or passing an lwp pointer around is
generally faster.  if the latter is significantly preferable,
how about kauth_cred_get_lwp which takes an lwp pointer and KASSERT
that it's curlwp?
given that it's generally unsafe to use l->l_cred unless l == curlwp,
having raw "l->l_cred" sprinkled is not a good idea, IMO.

YAMAMOTO Takashi