Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758602AbZGCT2D (ORCPT ); Fri, 3 Jul 2009 15:28:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756929AbZGCT1y (ORCPT ); Fri, 3 Jul 2009 15:27:54 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37850 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756475AbZGCT1x (ORCPT ); Fri, 3 Jul 2009 15:27:53 -0400 Message-ID: <4A4E4493.3040009@zytor.com> Date: Fri, 03 Jul 2009 10:49:07 -0700 From: "H. Peter Anvin" User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Linus Torvalds CC: mingo@redhat.com, paulus@samba.org, acme@redhat.com, Linux Kernel Mailing List , eric.dumazet@gmail.com, a.p.zijlstra@chello.nl, efault@gmx.de, arnd@arndb.de, fweisbec@gmail.com, dhowells@redhat.com, Andrew Morton , tglx@linutronix.de, Ingo Molnar Subject: Re: [tip:perfcounters/urgent] x86: atomic64: The atomic64_t data type should be 8 bytes aligned on 32-bit too References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1252 Lines: 32 Linus Torvalds wrote: > > It's not necessarily even about "two cachelines". It's true that crossing > cachelines is extra painful, but from a CPU core angle, there's another > access width that matters almost as much, namely the width of the bus > between the core and the L1 cache. If it's not aligned to that, the core > needs to do each 8-byte read/write as two accesses, even if it's to the > same cacheline, and that complicates things. > > The cacheline itself is generally larger than the cache access width. I > could easily see a 64B cacheline, but a 256b (32B) bus between the cache > and the core. > > Making the atomics be naturally aligned means that you never cross either > one, of course. > Sometimes, of course, that down-mux is where alignment happens, too. Either which way, I don't think there is any doubt that unaligned atomics are just asking for trouble. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf. -- 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/