|
@@ -3568,6 +3568,7 @@ perf_counter_alloc(struct perf_counter_attr *attr,
|
|
int cpu,
|
|
int cpu,
|
|
struct perf_counter_context *ctx,
|
|
struct perf_counter_context *ctx,
|
|
struct perf_counter *group_leader,
|
|
struct perf_counter *group_leader,
|
|
|
|
+ struct perf_counter *parent_counter,
|
|
gfp_t gfpflags)
|
|
gfp_t gfpflags)
|
|
{
|
|
{
|
|
const struct pmu *pmu;
|
|
const struct pmu *pmu;
|
|
@@ -3603,6 +3604,8 @@ perf_counter_alloc(struct perf_counter_attr *attr,
|
|
counter->ctx = ctx;
|
|
counter->ctx = ctx;
|
|
counter->oncpu = -1;
|
|
counter->oncpu = -1;
|
|
|
|
|
|
|
|
+ counter->parent = parent_counter;
|
|
|
|
+
|
|
counter->ns = get_pid_ns(current->nsproxy->pid_ns);
|
|
counter->ns = get_pid_ns(current->nsproxy->pid_ns);
|
|
counter->id = atomic64_inc_return(&perf_counter_id);
|
|
counter->id = atomic64_inc_return(&perf_counter_id);
|
|
|
|
|
|
@@ -3827,7 +3830,7 @@ SYSCALL_DEFINE5(perf_counter_open,
|
|
}
|
|
}
|
|
|
|
|
|
counter = perf_counter_alloc(&attr, cpu, ctx, group_leader,
|
|
counter = perf_counter_alloc(&attr, cpu, ctx, group_leader,
|
|
- GFP_KERNEL);
|
|
|
|
|
|
+ NULL, GFP_KERNEL);
|
|
ret = PTR_ERR(counter);
|
|
ret = PTR_ERR(counter);
|
|
if (IS_ERR(counter))
|
|
if (IS_ERR(counter))
|
|
goto err_put_context;
|
|
goto err_put_context;
|
|
@@ -3893,7 +3896,8 @@ inherit_counter(struct perf_counter *parent_counter,
|
|
|
|
|
|
child_counter = perf_counter_alloc(&parent_counter->attr,
|
|
child_counter = perf_counter_alloc(&parent_counter->attr,
|
|
parent_counter->cpu, child_ctx,
|
|
parent_counter->cpu, child_ctx,
|
|
- group_leader, GFP_KERNEL);
|
|
|
|
|
|
+ group_leader, parent_counter,
|
|
|
|
+ GFP_KERNEL);
|
|
if (IS_ERR(child_counter))
|
|
if (IS_ERR(child_counter))
|
|
return child_counter;
|
|
return child_counter;
|
|
get_ctx(child_ctx);
|
|
get_ctx(child_ctx);
|
|
@@ -3916,12 +3920,6 @@ inherit_counter(struct perf_counter *parent_counter,
|
|
*/
|
|
*/
|
|
add_counter_to_ctx(child_counter, child_ctx);
|
|
add_counter_to_ctx(child_counter, child_ctx);
|
|
|
|
|
|
- child_counter->parent = parent_counter;
|
|
|
|
- /*
|
|
|
|
- * inherit into child's child as well:
|
|
|
|
- */
|
|
|
|
- child_counter->attr.inherit = 1;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Get a reference to the parent filp - we will fput it
|
|
* Get a reference to the parent filp - we will fput it
|
|
* when the child counter exits. This is safe to do because
|
|
* when the child counter exits. This is safe to do because
|