Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756720Ab0LBC3u (ORCPT ); Wed, 1 Dec 2010 21:29:50 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:42761 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755928Ab0LBC3t (ORCPT ); Wed, 1 Dec 2010 21:29:49 -0500 Date: Wed, 1 Dec 2010 18:28:54 -0800 From: Andrew Morton To: Shaohua Li Cc: lkml , "hpa@zytor.com" , sam@ravnborg.org, eric.dumazet@gmail.com Subject: Re: [patch 1/3]make readmostly section correctly align Message-Id: <20101201182854.dd70bdf2.akpm@linux-foundation.org> In-Reply-To: <1291255341.12777.115.camel@sli10-conroe> References: <1291255341.12777.115.camel@sli10-conroe> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2108 Lines: 52 On Thu, 02 Dec 2010 10:02:21 +0800 Shaohua Li wrote: > readmostly section should end at cache line aligned address, otherwise the last > several data might share cachline with other data and make the readmostly data > still have cache bounce. > For example, in ia64, secpath_cachep is the last readmostly data, and it shares > cacheline with init_uts_ns. > a000000100e80480 d secpath_cachep > a000000100e80488 D init_uts_ns > > Signed-off-by: Shaohua Li > > --- > include/asm-generic/vmlinux.lds.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > Index: linux/include/asm-generic/vmlinux.lds.h > =================================================================== > --- linux.orig/include/asm-generic/vmlinux.lds.h 2010-12-01 16:49:48.000000000 +0800 > +++ linux/include/asm-generic/vmlinux.lds.h 2010-12-02 09:22:32.000000000 +0800 > @@ -192,7 +192,8 @@ > > #define READ_MOSTLY_DATA(align) \ > . = ALIGN(align); \ > - *(.data..read_mostly) > + *(.data..read_mostly) \ > + . = ALIGN(align); > > #define CACHELINE_ALIGNED_DATA(align) \ > . = ALIGN(align); \ > Surely the sane way to do this is to ensure that each section *starts* at an at-least-cacheline aligned address and then not worry about how the section ends. So shouldn't we be fixing DATA_DATA? With your approach, .data may end up sharing a cacheline with some other section in some undesirable manner on a different arch. "fixing" DATA_DATA would involve page-aligning it, which sucks a bit. Things would be better if include/asm-generic/vmlinux.lds.h had access to a globally-agreed cacheline-size, as it does the page size. otoh, .data.read_mostly is "special", in that it wants the tail end of its last cacheline not to share with any other section. Most other sections aren't like that. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/