From owner-svn-src-projects@FreeBSD.ORG  Fri May 29 07:40:58 2009
Return-Path: <owner-svn-src-projects@FreeBSD.ORG>
Delivered-To: svn-src-projects@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B83210656A9;
	Fri, 29 May 2009 07:40:58 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 7669B8FC26;
	Fri, 29 May 2009 07:40:58 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id 2D37046B2C;
	Fri, 29 May 2009 03:40:58 -0400 (EDT)
Date: Fri, 29 May 2009 08:40:58 +0100 (BST)
From: Robert Watson <rwatson@FreeBSD.org>
X-X-Sender: robert@fledge.watson.org
To: Brooks Davis <brooks@FreeBSD.org>
In-Reply-To: <200905282141.n4SLf1mo050648@svn.freebsd.org>
Message-ID: <alpine.BSF.2.00.0905290837130.86277@fledge.watson.org>
References: <200905282141.n4SLf1mo050648@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
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
X-BeenThere: svn-src-projects@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
	tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 May 2009 07:40:59 -0000


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