From owner-svn-src-all@FreeBSD.ORG Mon Oct 5 14:17:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3192A106568D; Mon, 5 Oct 2009 14:17:46 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id E79098FC22; Mon, 5 Oct 2009 14:17:45 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 565332C2CB6; Mon, 5 Oct 2009 09:17:45 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hEZ+jTjmcNlV; Mon, 5 Oct 2009 09:17:37 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 133372C2BF0; Mon, 5 Oct 2009 09:17:37 -0500 (CDT) Message-ID: <4ACA0000.2080005@cs.rice.edu> Date: Mon, 05 Oct 2009 09:17:36 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: John Baldwin References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> In-Reply-To: <4AC9F4F4.4030008@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r197750 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 05 Oct 2009 14:17:46 -0000 John Baldwin wrote: > Alan Cox wrote: >> Author: alc >> Date: Sun Oct 4 18:53:10 2009 >> New Revision: 197750 >> URL: http://svn.freebsd.org/changeset/base/197750 >> >> Log: >> Align and pad the page queue and free page queue locks so that the >> linker >> can't possibly place them together within the same cache line. >> MFC after: 3 weeks >> >> Modified: >> head/sys/vm/vm_page.c >> head/sys/vm/vm_page.h >> >> Modified: head/sys/vm/vm_page.c >> ============================================================================== >> >> --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) >> +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) >> @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); >> */ >> >> struct vpgqueues vm_page_queues[PQ_COUNT]; >> -struct mtx vm_page_queue_mtx; >> -struct mtx vm_page_queue_free_mtx; >> +struct vpglocks vm_page_queue_lock; >> +struct vpglocks vm_page_queue_free_lock; > > I think you can do this by just: > > struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); > > without the need for a wrapper structure. > Unfortunately, no. When I compile the following example: int a; int b __attribute__((aligned(16))); int x; int y; int z; int main(void) { return (0); } I get the following: 080495b4 A __bss_start 080495b4 A _edata 080495c0 b completed.4860 080495c4 B environ 080495d0 B b 080495d4 B x 080495d8 B z 080495dc B y 080495e0 B a 080495e4 A _end Thus, "b" is aligned as specified, but not padded to 16 bytes. Alan