Currently perf_event_context::type is used to determine whether a
context is cpu-bound or task-bound. However perf_event_context::task can
be used to determine this just as cheaply, and requires no additional
initialisation.

This patch removes perf_event_context::type, and modifies existing users
to check check perf_event_context::task instead. The now unused enum
perf_event_context_type is removed.

Signed-off-by: Mark Rutland <[email protected]>
Reviewed-by: Dave Martin <[email protected]>
Acked-by: Will Deacon <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
---
 include/linux/perf_event.h | 6 ------
 kernel/events/core.c       | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e56b07f..df3d34a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -440,11 +440,6 @@ struct perf_event {
 #endif /* CONFIG_PERF_EVENTS */
 };
 
-enum perf_event_context_type {
-       task_context,
-       cpu_context,
-};
-
 /**
  * struct perf_event_context - event context structure
  *
@@ -452,7 +447,6 @@ enum perf_event_context_type {
  */
 struct perf_event_context {
        struct pmu                      *pmu;
-       enum perf_event_context_type    type;
        /*
         * Protect the states of the events in the list,
         * nr_active, and the list:
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 15fe6fc..e2fcf1b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6493,7 +6493,6 @@ skip_type:
                __perf_event_init_context(&cpuctx->ctx);
                lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex);
                lockdep_set_class(&cpuctx->ctx.lock, &cpuctx_lock);
-               cpuctx->ctx.type = cpu_context;
                cpuctx->ctx.pmu = pmu;
 
                __perf_cpu_hrtimer_init(cpuctx, cpu);
@@ -7130,7 +7129,7 @@ SYSCALL_DEFINE5(perf_event_open,
                 * task or CPU context:
                 */
                if (move_group) {
-                       if (group_leader->ctx->type != ctx->type)
+                       if (group_leader->ctx->task != ctx->task)
                                goto err_context;
                } else {
                        if (group_leader->ctx != ctx)
-- 
1.8.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to