[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1370968960-22527-11-git-send-email-rric@kernel.org>
Date: Tue, 11 Jun 2013 18:42:36 +0200
From: Robert Richter <rric@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
Robert Richter <robert.richter@...aro.org>,
Robert Richter <rric@...nel.org>
Subject: [PATCH v2 10/14] perf, persistent: Avoid adding identical events
From: Robert Richter <robert.richter@...aro.org>
Check if an event already exists before adding it.
Signed-off-by: Robert Richter <robert.richter@...aro.org>
Signed-off-by: Robert Richter <rric@...nel.org>
---
kernel/events/persistent.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c
index 586cea5..4fcd071 100644
--- a/kernel/events/persistent.c
+++ b/kernel/events/persistent.c
@@ -40,6 +40,12 @@ add_persistent_event_on_cpu(unsigned int cpu, struct perf_event_attr *attr,
mutex_lock(&per_cpu(pers_events_lock, cpu));
+ desc = get_persistent_event(cpu, attr);
+ if (desc) {
+ event = ERR_PTR(-EEXIST);
+ goto out;
+ }
+
desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc) {
event = ERR_PTR(-ENOMEM);
--
1.8.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists