From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932887AbcFJPWl (ORCPT ); Fri, 10 Jun 2016 11:22:41 -0400 Received: from www.linutronix.de ([62.245.132.108]:35220 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331AbcFJPWk (ORCPT ); Fri, 10 Jun 2016 11:22:40 -0400 Date: Fri, 10 Jun 2016 17:20:43 +0200 (CEST) From: Thomas Gleixner To: Nicolas Pitre cc: Daniel Lezcano , shreyas@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, peterz@infradead.org, rafael@kernel.org, vincent.guittot@linaro.org Subject: Re: [PATCH V4] irq: Track the interrupt timings In-Reply-To: Message-ID: References: <1460545556-15085-1-git-send-email-daniel.lezcano@linaro.org> 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 On Fri, 10 Jun 2016, Nicolas Pitre wrote: > On Fri, 10 Jun 2016, Thomas Gleixner wrote: > > > + diff = now - prev; > > > + > > > + /* > > > + * microsec (actually 1024th of a milisec) precision is good > > > + * enough for our purpose. > > > + */ > > > + diff >>= 10; > > > > And that shift instruction is required because of the following? > > > > > * Otherwise we know the magnitude of diff is > > > + * well within 32 bits. > > > > AFAICT that's pointless. You are not saving anything because NSEC_PER_SEC is > > smaller than 2^32 and your 8 values are not going to overflow 64 bit in the > > sum. > > Those values are squared later, so we really want 32 bits here. Well, you can do sum >> 10 exaclty once when you calculate stuff. > > > + */ > > > + if (unlikely(diff > USEC_PER_SEC)) { > > > + memset(timings, 0, sizeof(*timings)); > > > + timings->timestamp = now; > > > > Redundant store. > > We just trashed all our data with the memset so the current timestamp > needs to be restored. So why doing a full memset and not only on the array ? > > Now the real question is whether you really need all that math, checks and > > memsets in the irq hotpath. If you make the storage slightly larger then you > > can just store the values unconditionally in the circular buffer and do all > > the computational stuff when you really it. > > Well... given that you need an IRQ everytime you come out of idle that > means there will always be more IRQs than entries into idle, so you're > probably right. Glad you agree. Thanks, tglx