From owner-freebsd-arch@FreeBSD.ORG Tue Apr 14 19:30:52 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 757D6106568E; Tue, 14 Apr 2009 19:30:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 15CD58FC14; Tue, 14 Apr 2009 19:30:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id E5F8E46B96; Tue, 14 Apr 2009 15:30:50 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 5B2A38A04D; Tue, 14 Apr 2009 15:30:49 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Tue, 14 Apr 2009 09:48:34 -0400 User-Agent: KMail/1.9.7 References: <200904140105.20664.max@love2party.net> In-Reply-To: <200904140105.20664.max@love2party.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904140948.34503.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 14 Apr 2009 15:30:49 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=1.5 required=4.2 tests=DATE_IN_PAST_03_06,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Max Laier , Robert Watson Subject: Re: Simple #define for cache line size X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 19:30:54 -0000 On Monday 13 April 2009 7:05:20 pm Max Laier wrote: > On Saturday 11 April 2009 18:11:55 Robert Watson wrote: > > Dear all: > > > > We have a number of __aligned() qualifiers scattered around the kernel > > intended to space objects to improve alignment with respect to cache lines. > > This is important for a number of reasons, not least avoiding cache line > > thrashing when using arrays of foo[MAXCPU]. What I'd like to do is provide > > a single compile-time constant, CACHE_LINE_SIZE, defined in > > machine-dependent param.h, to use for spacing such objects, rather than > > hard-coding various values around. Here are some examples of existing > > spacing attempts: > > How much does __aligned(FOO) even achieve? If we allocate these structs at > runtime the alignment requirements have to be passed to the allocator as well > (eg. uma(9)'s align parameter in uma_zcreate). If my assumption is correct it > would make sense to have a global symbol that is initialized early in the boot > process instead of a compile time #define. > > In addition it seems that we need to make the define a worst case value to > assure correctness for static arrays as below. Actually, we need both the boot-time tunable that UMA has I think and a worst-case constant for static arrays. UMA already has the tunable and I think it should remain (though we may want to provide a way for the MD code to adjust its value). I think the constant is still needed for static arrays and should also be used to initialize the constant in UMA. -- John Baldwin