Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 May 2009 08:40:58 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Brooks Davis <brooks@FreeBSD.org>
Cc:        svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r192998 - in projects/ngroups: lib/libkvm sys/compat/linux sys/i386/ibcs2 sys/kern sys/nfsserver sys/sys
Message-ID:  <alpine.BSF.2.00.0905290837130.86277@fledge.watson.org>
In-Reply-To: <200905282141.n4SLf1mo050648@svn.freebsd.org>
References:  <200905282141.n4SLf1mo050648@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 28 May 2009, Brooks Davis wrote:

>   * Replace the embedded cr_groups[NGROUPS] member of struct cred with
>     a pointer to malloc'd storage and a cr_agroups value which tracks
>     the number of allocated group slots.  When more space is required
>     crextend() is used to add more space.  The new crcopysafe() function
>     calls crextend as needed when saving a copy of a credential from a
>     process before modification.

I'm glad to see this work finally happening.  Last time I looked at doing this 
(and bounced eventually), I took a slightly different approach here: I moved 
away from slab-allocating struct ucred, and instead malloc'd it as a 
variable-length structure based on the number of additional gid's needed.  I 
set the minimize size to the current NGROUPS so that we'd use larger 
constainer structs only if required.  This reduces the number of interactions 
with the memory allocator, which has some benefits, although it makes 
extending struct ucred a more risk-prone thing from a binary compatibility 
perspective in the kernel.  It also reduces the number of indirections to 
non-local memory and potentially the cache footprint.  This is not a change 
request, just an observation an alternative memory strategy.  And with its 
downsides as well, of course.

Robert N M Watson
Computer Laboratory
University of Cambridge



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