From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754438AbdEJXk1 (ORCPT ); Wed, 10 May 2017 19:40:27 -0400 Received: from ozlabs.org ([103.22.144.67]:57539 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752965AbdEJXk0 (ORCPT ); Wed, 10 May 2017 19:40:26 -0400 Date: Thu, 11 May 2017 09:40:22 +1000 From: Stephen Rothwell To: Thomas Gleixner Cc: Anju T Sudhakar , stewart@linux.vnet.ibm.com, ego@linux.vnet.ibm.com, mikey@neuling.org, maddy@linux.vnet.ibm.com, Peter Zijlstra , LKML , eranian@google.com, hemant@linux.vnet.ibm.com, Anton Blanchard , sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, dja@axtens.net Subject: Re: [PATCH v8 05/10] powerpc/perf: IMC pmu cpumask and cpuhotplug support Message-ID: <20170511094022.38a32f2e@canb.auug.org.au> In-Reply-To: References: <1493907596-11425-1-git-send-email-anju@linux.vnet.ibm.com> <1493907596-11425-6-git-send-email-anju@linux.vnet.ibm.com> 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 Hi, On Wed, 10 May 2017 14:09:53 +0200 (CEST) Thomas Gleixner wrote: > > > +static void nest_change_cpu_context(int old_cpu, int new_cpu) > > +{ > > + int i; > > + > > + for (i = 0; > > + (per_nest_pmu_arr[i] != NULL) && (i < IMC_MAX_PMUS); i++) > > + perf_pmu_migrate_context(&per_nest_pmu_arr[i]->pmu, > > + old_cpu, new_cpu); > > Bah, this is horrible to read. > > struct imc_pmu **pn = per_nest_pmu_arr; > int i; > > for (i = 0; *pn && i < IMC_MAX_PMUS; i++, pn++) > perf_pmu_migrate_context(&(*pn)->pmu, old_cpu, new_cpu); (Just a bit of bike shedding ...) Or even (since "i" is not used any more): struct imc_pmu **pn; for (pn = per_nest_pmu_arr; pn < &per_nest_pmu_arr[IMC_MAX_PMUS] && *pn; pn++) perf_pmu_migrate_context(&(*pn)->pmu, old_cpu, new_cpu); -- Cheers, Stephen Rothwell