svn commit: r274122 - in head/sys: kern sys

Mateusz Guzik mjguzik at gmail.com
Wed Nov 5 02:11:48 UTC 2014


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>


More information about the svn-src-head mailing list