Skip to content

Commit 1fd7e41

Browse files
David Carrillo-CisnerosIngo Molnar
authored andcommitted
perf/core: Remove perf_cpu_context::unique_pmu
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Mark Rutland <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Paul Turner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Srinivas Pandruvada <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vikas Shivappa <[email protected]> Cc: Vince Weaver <[email protected]> Cc: Vince Weaver <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 058fe1c commit 1fd7e41

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

include/linux/perf_event.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,6 @@ struct perf_cpu_context {
785785
ktime_t hrtimer_interval;
786786
unsigned int hrtimer_active;
787787

788-
struct pmu *unique_pmu;
789788
#ifdef CONFIG_CGROUP_PERF
790789
struct perf_cgroup *cgrp;
791790
struct list_head cgrp_cpuctx_entry;

kernel/events/core.c

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,7 +2932,7 @@ static void perf_pmu_sched_task(struct task_struct *prev,
29322932
return;
29332933

29342934
list_for_each_entry(cpuctx, this_cpu_ptr(&sched_cb_list), sched_cb_entry) {
2935-
pmu = cpuctx->unique_pmu; /* software PMUs will not have sched_task */
2935+
pmu = cpuctx->ctx.pmu; /* software PMUs will not have sched_task */
29362936

29372937
if (WARN_ON_ONCE(!pmu->sched_task))
29382938
continue;
@@ -8636,37 +8636,10 @@ static struct perf_cpu_context __percpu *find_pmu_context(int ctxn)
86368636
return NULL;
86378637
}
86388638

8639-
static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu)
8640-
{
8641-
int cpu;
8642-
8643-
for_each_possible_cpu(cpu) {
8644-
struct perf_cpu_context *cpuctx;
8645-
8646-
cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
8647-
8648-
if (cpuctx->unique_pmu == old_pmu)
8649-
cpuctx->unique_pmu = pmu;
8650-
}
8651-
}
8652-
86538639
static void free_pmu_context(struct pmu *pmu)
86548640
{
8655-
struct pmu *i;
8656-
86578641
mutex_lock(&pmus_lock);
8658-
/*
8659-
* Like a real lame refcount.
8660-
*/
8661-
list_for_each_entry(i, &pmus, entry) {
8662-
if (i->pmu_cpu_context == pmu->pmu_cpu_context) {
8663-
update_pmu_context(i, pmu);
8664-
goto out;
8665-
}
8666-
}
8667-
86688642
free_percpu(pmu->pmu_cpu_context);
8669-
out:
86708643
mutex_unlock(&pmus_lock);
86718644
}
86728645

@@ -8870,8 +8843,6 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type)
88708843
cpuctx->ctx.pmu = pmu;
88718844

88728845
__perf_mux_hrtimer_init(cpuctx, cpu);
8873-
8874-
cpuctx->unique_pmu = pmu;
88758846
}
88768847

88778848
got_cpu_context:

0 commit comments

Comments
 (0)