[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1285583997-1262-2-git-send-email-namhyung@gmail.com>
Date: Mon, 27 Sep 2010 19:39:53 +0900
From: Namhyung Kim <namhyung@...il.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 1/5] perf: Wrap perf_lock_task_context using __cond_lock()
perf_lock_task_context() conditionally grabs ctx->lock in case of
returning non-NULL. Rename and wrap it using __cond_lock to make
sparse happy.
Signed-off-by: Namhyung Kim <namhyung@...il.com>
---
kernel/perf_event.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index db5b560..c058a42 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -151,7 +151,7 @@ static u64 primary_event_id(struct perf_event *event)
* the context could get moved to another task.
*/
static struct perf_event_context *
-perf_lock_task_context(struct task_struct *task, unsigned long *flags)
+__perf_lock_task_context(struct task_struct *task, unsigned long *flags)
{
struct perf_event_context *ctx;
@@ -184,6 +184,14 @@ perf_lock_task_context(struct task_struct *task, unsigned long *flags)
return ctx;
}
+static inline struct perf_event_context *
+perf_lock_task_context(struct task_struct *task, unsigned long *flags)
+{
+ struct perf_event_context *ctx;
+ __cond_lock(&ctx->lock, ctx = __perf_lock_task_context(task, flags));
+ return ctx;
+}
+
/*
* Get the context for a task and increment its pin_count so it
* can't get swapped to another task. This also increments its
--
1.7.2.2
--
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