[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1370968960-22527-7-git-send-email-rric@kernel.org>
Date: Tue, 11 Jun 2013 18:42:32 +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 06/14] perf, persistent: Remove rb_put()
From: Robert Richter <robert.richter@...aro.org>
rb_put() is called already in perf_event_release_kernel(), so no need
to do the same in del_persistent_event(). We also don't need it in
add_persistent_event_on_cpu() after a rework. Since there are no users
of rb_put() anymore, we can make it private again to only
events/core.c.
Signed-off-by: Robert Richter <robert.richter@...aro.org>
Signed-off-by: Robert Richter <rric@...nel.org>
---
kernel/events/core.c | 4 +++-
kernel/events/internal.h | 1 -
kernel/events/persistent.c | 29 +++++++++++------------------
3 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a9b6470..8f85caa 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3021,6 +3021,8 @@ static void free_event_rcu(struct rcu_head *head)
kfree(event);
}
+static void rb_put(struct ring_buffer *rb);
+
static void free_event(struct perf_event *event)
{
irq_work_sync(&event->pending);
@@ -3680,7 +3682,7 @@ static struct ring_buffer *rb_get(struct perf_event *event)
return rb;
}
-void rb_put(struct ring_buffer *rb)
+static void rb_put(struct ring_buffer *rb)
{
struct perf_event *event, *n;
unsigned long flags;
diff --git a/kernel/events/internal.h b/kernel/events/internal.h
index 3b481be..3647289 100644
--- a/kernel/events/internal.h
+++ b/kernel/events/internal.h
@@ -38,7 +38,6 @@ struct ring_buffer {
extern void rb_free(struct ring_buffer *rb);
extern struct ring_buffer *
rb_alloc(int nr_pages, long watermark, int cpu, int flags);
-extern void rb_put(struct ring_buffer *rb);
extern void perf_event_wakeup(struct perf_event *event);
extern void
diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c
index d7aaf95..e6a7664 100644
--- a/kernel/events/persistent.c
+++ b/kernel/events/persistent.c
@@ -20,22 +20,22 @@ static struct perf_event *
add_persistent_event_on_cpu(unsigned int cpu, struct perf_event_attr *attr,
unsigned nr_pages)
{
- struct perf_event *event = ERR_PTR(-ENOMEM);
+ struct perf_event *event;
struct pers_event_desc *desc;
struct ring_buffer *buf;
desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
- goto out;
-
- buf = rb_alloc(nr_pages, 0, cpu, 0);
- if (!buf)
- goto err_rb;
+ return ERR_PTR(-ENOMEM);
event = perf_event_create_kernel_counter(attr, cpu, NULL, NULL, NULL);
if (IS_ERR(event))
goto err_event;
+ buf = rb_alloc(nr_pages, 0, cpu, 0);
+ if (!buf)
+ goto err_rb;
+
rcu_assign_pointer(event->rb, buf);
desc->event = event;
@@ -47,14 +47,12 @@ add_persistent_event_on_cpu(unsigned int cpu, struct perf_event_attr *attr,
perf_event_enable(event);
goto out;
-
- err_event:
- rb_put(buf);
-
- err_rb:
+err_rb:
+ perf_event_release_kernel(event);
+ event = ERR_PTR(-ENOMEM);
+err_event:
kfree(desc);
-
- out:
+out:
return event;
}
@@ -76,11 +74,6 @@ static void del_persistent_event(int cpu, struct perf_event_attr *attr)
list_del(&desc->plist);
perf_event_disable(event);
- if (event->rb) {
- rb_put(event->rb);
- rcu_assign_pointer(event->rb, NULL);
- }
-
perf_event_release_kernel(event);
put_unused_fd(desc->fd);
kfree(desc);
--
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