From owner-svn-src-all@FreeBSD.ORG Wed Nov 5 02:11:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44AA8940; Wed, 5 Nov 2014 02:11:48 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 899BFA4E; Wed, 5 Nov 2014 02:11:47 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id hi2so715121wib.7 for ; Tue, 04 Nov 2014 18:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=UNw7HlnAEmvoqMW6FztZOIm4ckTOwbolW7nEtdUG5OQ=; b=Q2xmOByo/hhgX/O0qJTBAUTjG23L3GNd0KgxAAxyH1vWvqcETzNXm9r5Cpx0aE4Ous 389m5XYHhrkLct4YpqUQ17e+fP5kAGzz/+fsDRum0cdmwTO+6q0vNuYs4jOFR1HaeiyQ dWPJEEGuJjtfK7O6O3qJa/ZYKOAg+BGvD+qPNmCdhIcxygDYV8bawNA+QXHf/jaj+WRh 2nR25xpq/Gs9/7dOIYoJ9s+b/AaT5CwuHr5/+XDg4CtN71rcNXPze0xwHL856uE23p41 F0JP/zd2wFe4QOECV3T/4djXi0kyRRwsRik3Yt5KCKXqiCnx9/6PNPWj6MCrdytRl5IA 8A+Q== X-Received: by 10.180.93.233 with SMTP id cx9mr2023747wib.48.1415153505780; Tue, 04 Nov 2014 18:11:45 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id m6sm2876126wiy.16.2014.11.04.18.11.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Nov 2014 18:11:45 -0800 (PST) Date: Wed, 5 Nov 2014 03:11:42 +0100 From: Mateusz Guzik To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r274122 - in head/sys: kern sys Message-ID: <20141105021142.GB21297@dft-labs.eu> References: <201411050208.sA528cPs051738@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201411050208.sA528cPs051738@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 02:11:48 -0000 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