Skip to content

Commit 5a09928

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86: Remove task_ctx_size
A new kmem_cache method has replaced the kzalloc() to allocate the PMU specific data. The task_ctx_size is not required anymore. Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 33cad28 commit 5a09928

File tree

4 files changed

+1
-9
lines changed

4 files changed

+1
-9
lines changed

arch/x86/events/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2371,7 +2371,6 @@ static struct pmu pmu = {
23712371

23722372
.event_idx = x86_pmu_event_idx,
23732373
.sched_task = x86_pmu_sched_task,
2374-
.task_ctx_size = sizeof(struct x86_perf_task_context),
23752374
.swap_task_ctx = x86_pmu_swap_task_ctx,
23762375
.check_period = x86_pmu_check_period,
23772376

arch/x86/events/intel/lbr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,6 @@ void __init intel_pmu_arch_lbr_init(void)
16721672

16731673
size = sizeof(struct x86_perf_task_context_arch_lbr) +
16741674
lbr_nr * sizeof(struct lbr_entry);
1675-
x86_get_pmu()->task_ctx_size = size;
16761675
x86_get_pmu()->task_ctx_cache = create_lbr_kmem_cache(size, 0);
16771676

16781677
x86_pmu.lbr_from = MSR_ARCH_LBR_FROM_0;

include/linux/perf_event.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,6 @@ struct pmu {
419419
*/
420420
void (*sched_task) (struct perf_event_context *ctx,
421421
bool sched_in);
422-
/*
423-
* PMU specific data size
424-
*/
425-
size_t task_ctx_size;
426422

427423
/*
428424
* Kmem cache of PMU specific data

kernel/events/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,15 +1243,13 @@ static void *alloc_task_ctx_data(struct pmu *pmu)
12431243
if (pmu->task_ctx_cache)
12441244
return kmem_cache_zalloc(pmu->task_ctx_cache, GFP_KERNEL);
12451245

1246-
return kzalloc(pmu->task_ctx_size, GFP_KERNEL);
1246+
return NULL;
12471247
}
12481248

12491249
static void free_task_ctx_data(struct pmu *pmu, void *task_ctx_data)
12501250
{
12511251
if (pmu->task_ctx_cache && task_ctx_data)
12521252
kmem_cache_free(pmu->task_ctx_cache, task_ctx_data);
1253-
else
1254-
kfree(task_ctx_data);
12551253
}
12561254

12571255
static void free_ctx(struct rcu_head *head)

0 commit comments

Comments
 (0)