From owner-svn-src-head@FreeBSD.ORG Mon Apr 8 23:32:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A78485DB; Mon, 8 Apr 2013 23:32:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by mx1.freebsd.org (Postfix) with ESMTP id 43FA8308; Mon, 8 Apr 2013 23:32:22 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r38NWBjN015420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Apr 2013 09:32:13 +1000 Date: Tue, 9 Apr 2013 09:32:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff Subject: Re: svn commit: r249265 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sys In-Reply-To: <20130408194436.GI76816@FreeBSD.org> Message-ID: <20130409090906.X1317@besplex.bde.org> References: <201304081919.r38JJAvB088644@svn.freebsd.org> <201304081541.27408.jhb@freebsd.org> <20130408194436.GI76816@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Ov0XUFDt c=1 sm=1 a=ZmwpETj09uMA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=IOvs9-exVioA:10 a=6I5d2MoRAAAA:8 a=o6H9giKKc9XhkaVdGnoA:9 a=CjuIK1q_8ugA:10 a=p4VOkwfX5Yu8O-DJ:21 a=VNgWRUltHtPrVWRC:21 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 23:32:23 -0000 On Mon, 8 Apr 2013, Gleb Smirnoff wrote: > On Mon, Apr 08, 2013 at 03:41:27PM -0400, John Baldwin wrote: > J> On Monday, April 08, 2013 3:19:10 pm Gleb Smirnoff wrote: > J> > Author: glebius > J> > Date: Mon Apr 8 19:19:10 2013 > J> > New Revision: 249265 > J> > URL: http://svnweb.freebsd.org/changeset/base/249265 > J> > > J> > Log: > J> > Merge from projects/counters: > J> > > J> > Pad struct pcpu so that its size is denominator of PAGE_SIZE. This > J> > is done to reduce memory waste in UMA_PCPU_ZONE zones. > J> > > J> > Sponsored by: Nginx, Inc. > J> > > J> > Modified: head/sys/sys/pcpu.h > J> > > J> ============================================================================== > J> > --- head/sys/sys/pcpu.h Mon Apr 8 19:10:45 2013 (r249264) > J> > +++ head/sys/sys/pcpu.h Mon Apr 8 19:19:10 2013 (r249265) > J> > @@ -180,6 +180,14 @@ struct pcpu { > J> > PCPU_MD_FIELDS; > J> > } __aligned(CACHE_LINE_SIZE); > J> > J> Why not change this to be PAGE_SIZE rather than putting explicit padding in > J> all the pcpu fields? That would seem to be more maintainable. > > Because it can be smaller than PAGE_SIZE. Two times smaller, four times smaller. I said in private mail that I don't see a better way to do this. Now I see a way that might work: #define (in the MD pcpu.h) the expected number of times smaller (hopefully not fractional). This won't change very often. Then, if large alignments like PAGE_SIZE work, then smaller ones like PAGE_SIZE / will also work. How does explicit aligning to only CACHE_LINE_SIZE work anyway? I think you actually need PAGE_SIZE/N, and get this by magic padding combined with explicit alignment to only CACHE_LINE_SIZE. Bruce Bruce