Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934016AbbKSKhj (ORCPT ); Thu, 19 Nov 2015 05:37:39 -0500 Received: from www.linutronix.de ([62.245.132.108]:39256 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932355AbbKSKhg (ORCPT ); Thu, 19 Nov 2015 05:37:36 -0500 Date: Thu, 19 Nov 2015 11:36:53 +0100 (CET) From: Thomas Gleixner To: Russell King - ARM Linux cc: Marc Gonzalez , Daniel Lezcano , LKML , Mans Rullgard , Viresh Kumar , Nicolas Pitre , Tony Lindgren , Sebastian Frias Subject: Re: [PATCH] clocksource: Store reg field within struct clocksource In-Reply-To: <20151119103354.GU8644@n2100.arm.linux.org.uk> Message-ID: References: <564C8086.80804@sigmadesigns.com> <20151118172114.GS8644@n2100.arm.linux.org.uk> <564D9605.4010207@sigmadesigns.com> <20151119103354.GU8644@n2100.arm.linux.org.uk> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2058 Lines: 49 On Thu, 19 Nov 2015, Russell King - ARM Linux wrote: > On Thu, Nov 19, 2015 at 10:27:33AM +0100, Marc Gonzalez wrote: > > On 18/11/2015 18:21, Russell King - ARM Linux wrote: > > > On Wed, Nov 18, 2015 at 02:43:34PM +0100, Marc Gonzalez wrote: > > > > > >> Since 'struct clocksource' is ____cacheline_aligned, gcc must insert > > >> a lot of padding between reg and clksrc in 'struct clocksource_mmio' > > >> (for example, L1_CACHE_BYTES = 64 on ARMv7). > > >> > > >> Storing reg within 'struct clocksource' removes unnecessary padding, > > >> and reg can then be grouped with other hot data. A nice side-effect > > >> of this patch is making container_of() unnecessary, which makes the > > >> code a bit simpler. > > >> > > >> On 32-bit platforms, reg fits in the padding between read and mask, > > >> meaning no downside from storing it there. > > > > > > Just swap the order of 'reg' and 'clksrc'. > > > > You already suggested that the last time (April 1st). > > What problem is this supposed to solve? > > Swapping the fields does not change the amount of padding required, > > and does not place reg close to the hot data. > > > > On a 32-bit platform, with L1_CACHE_BYTES = 64 > > > > sizeof(struct unaligned_clocksource) = 80 > > sizeof(struct clocksource) = 128 > > sizeof(struct clocksource_mmio) = 192, reg at +0, clksrc at +64 > > sizeof(struct clocksource_mmio2) = 192, reg at +128, clksrc at +0 > > > > Same amount of padding. > > Maybe the ____cacheline_aligned is inappropriate then, because it means > any wrapping of struct clocksource has exactly the same problem. We could do that, but that does not necessarily solve the cache footprint issue. Aside of that we'd need to add ____cacheline_aligned to quite some of the statically allocated clocksource declarations. Thanks, tglx -- 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/