Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1563536

Re: [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.szaf.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu
Date Fri, 20 Jan 2017 13:30:03 +0100
Message-ID <t1Gun-7bo-29@gated-at.bofh.it> (permalink)
References <t145H-86O-7@gated-at.bofh.it> <t145I-86O-33@gated-at.bofh.it>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23.1 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 56
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, "x86@kernel.org" <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Andi Kleen <ak@linux.intel.com>, Kan Liang <kan.liang@intel.com>, Borislav Petkov <bp@suse.de>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Dave Hansen <dave.hansen@linux.intel.com>, Vikas Shivappa <vikas.shivappa@linux.intel.com>, Mark Rutland <mark.rutland@arm.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Vince Weaver <vince@deater.net>, Paul Turner <pjt@google.com>, Stephane Eranian <eranian@google.com>
X-Original-Date Fri, 20 Jan 2017 10:20:33 +0100
X-Original-Message-ID <20170120092033.GK6515@twins.programming.kicks-ass.net>
X-Original-References <20170118192454.58008-1-davidcc@google.com> <20170118192454.58008-3-davidcc@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1563536

Show key headers only | View raw


On Wed, Jan 18, 2017 at 11:24:54AM -0800, David Carrillo-Cisneros wrote:
> cpuctx->unique_pmu was originally introduced as a way to identify cpuctxs
> with shared pmus in order to avoid visiting the same cpuctx more than once
> in a for_each_pmu loop.
> 
> cpuctx->unique_pmu == cpuctx->pmu in non-software task contexts since they
> have only one pmu per cpuctx. Since perf_pmu_sched_task is only called in
> hw contexts, this patch replaces cpuctx->unique_pmu by cpuctx->pmu in it.
> 
> The change above, together with the previous patch in this series, removed
> the remaining uses of cpuctx->unique_pmu, so we remove it altogether.
> 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> Acked-by: Mark Rutland <mark.rutland@arm.com>


> @@ -8572,37 +8572,10 @@ static struct perf_cpu_context __percpu *find_pmu_context(int ctxn)
>  	return NULL;
>  }
>  
> -static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu)
> -{
> -	int cpu;
> -
> -	for_each_possible_cpu(cpu) {
> -		struct perf_cpu_context *cpuctx;
> -
> -		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
> -
> -		if (cpuctx->unique_pmu == old_pmu)
> -			cpuctx->unique_pmu = pmu;
> -	}
> -}
> -
>  static void free_pmu_context(struct pmu *pmu)
>  {
> -	struct pmu *i;
> -
>  	mutex_lock(&pmus_lock);
> -	/*
> -	 * Like a real lame refcount.
> -	 */
> -	list_for_each_entry(i, &pmus, entry) {
> -		if (i->pmu_cpu_context == pmu->pmu_cpu_context) {
> -			update_pmu_context(i, pmu);
> -			goto out;
> -		}
> -	}
> -
>  	free_percpu(pmu->pmu_cpu_context);
> -out:
>  	mutex_unlock(&pmus_lock);
>  }

This very much relies on us never calling perf_pmu_unregister() on the
software PMUs afaict. A condition not mention in the Changelog.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] Optimize cgroup ctx switch and remove cpuctx->unique_pmu David Carrillo-Cisneros <davidcc@google.com> - 2017-01-18 20:30 +0100
  [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu David Carrillo-Cisneros <davidcc@google.com> - 2017-01-18 20:30 +0100
    Re: [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu Peter Zijlstra <peterz@infradead.org> - 2017-01-20 13:30 +0100
      Re: [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu Mark Rutland <mark.rutland@arm.com> - 2017-01-20 15:30 +0100
      Re: [PATCH v2 2/2] perf/core: Remove perf_cpu_context::unique_pmu David Carrillo-Cisneros <davidcc@google.com> - 2017-01-20 22:50 +0100
    [tip:perf/core] perf/core: Remove perf_cpu_context::unique_pmu tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-01-30 13:00 +0100
  [PATCH v2 1/2] perf/core: Make cgroup switch visit only cpuctxs with cgroup events David Carrillo-Cisneros <davidcc@google.com> - 2017-01-18 20:30 +0100
    [tip:perf/core] perf/core: Make cgroup switch visit only cpuctxs  with cgroup events tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-01-30 13:00 +0100

csiph-web