Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Nov 2014 03:11:42 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r274122 - in head/sys: kern sys
Message-ID:  <20141105021142.GB21297@dft-labs.eu>
In-Reply-To: <201411050208.sA528cPs051738@svn.freebsd.org>
References:  <201411050208.sA528cPs051738@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 05, 2014 at 02:08:38AM +0000, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Nov  5 02:08:37 2014
> New Revision: 274122
> URL: https://svnweb.freebsd.org/changeset/base/274122
> 
> Log:
>   Extend struct ucred with group table.
>   
>   This saves one malloc + free with typical cases and better utilizes
>   memory.
>   
> @@ -64,13 +66,12 @@ struct ucred {
>  	struct auditinfo_addr	cr_audit;	/* Audit properties. */
>  	gid_t	*cr_groups;		/* groups */
>  	int	cr_agroups;		/* Available groups */
> +	gid_t   cr_smallgroups[XU_NGROUPS];	/* storage for small groups */
>  };

This struct ate 160 bytes on e.g. amd64, so was using a 256 byte buffer
anyway and previously separately allocated groups fit there no problem.

On 32-bit systems struct was smaller and e.g. on i386 it was only 120
bytes, so for such systems this change increases memory usage a little.

If someone really does not like it I'm happy to ifdef the code.

-- 
Mateusz Guzik <mjguzik gmail.com>



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