From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807AbcBVQEn (ORCPT ); Mon, 22 Feb 2016 11:04:43 -0500 Received: from casper.infradead.org ([85.118.1.10]:53942 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753754AbcBVQEi (ORCPT ); Mon, 22 Feb 2016 11:04:38 -0500 Date: Mon, 22 Feb 2016 17:04:36 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , x86@kernel.org, Borislav Petkov , Stephane Eranian , Harish Chegondi , Kan Liang , Andi Kleen , Jacob Pan Subject: Re: [patch V2 26/28] x86/perf/intel/rapl: Convert it to a per package facility Message-ID: <20160222160436.GK6357@twins.programming.kicks-ass.net> References: <20160222110337.198341739@linutronix.de> <20160222110442.423353725@linutronix.de> <20160222120818.GD6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 22, 2016 at 04:52:28PM +0100, Thomas Gleixner wrote: > On Mon, 22 Feb 2016, Peter Zijlstra wrote: > > > On Mon, Feb 22, 2016 at 11:07:02AM -0000, Thomas Gleixner wrote: > > > +static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) > > > +{ > > > + return rapl_pmus->pmus[topology_logical_package_id(cpu)]; > > > +} > > > > > @@ -370,6 +378,7 @@ static int rapl_pmu_event_init(struct pe > > > return -EINVAL; > > > > > > /* must be done before validate_group */ > > > + pmu = cpu_to_rapl_pmu(event->cpu); > > > event->cpu = pmu->cpu; > > > event->pmu_private = pmu; > > > > This again looks like pmu_private is 'trivially' replacable with > > something like: > > > > static inline struct rapl_pmu *event_to_rapl_pmu(struct perf_event *event) > > { > > return cpu_to_rapl_pmu(event->cpu); > > } > > Yes, it is. But that's 3 loads versus 1 and we have that in the perf fastpath, > so I prefer to keep the pmu_private add on. OK, fair enough.