diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2019-07-04 15:13:23 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-07-25 15:51:54 +0200 |
commit | 7b3c92b85a65c2db1f542265bc98e1f9e3056eba (patch) | |
tree | 14ce7357c1f489793d3989db344d6782e85824f8 /kernel/events | |
parent | 3c29e651e16dd3b3179cfb2d055ee9538e37515c (diff) | |
download | linux-7b3c92b85a65c2db1f542265bc98e1f9e3056eba.tar.bz2 |
sched/core: Convert get_task_struct() to return the task
Returning the pointer that was passed in allows us to write
slightly more idiomatic code. Convert a few users.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190704221323.24290-1-willy@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/core.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 026a14541a38..ea5e8139fe62 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -4089,10 +4089,8 @@ alloc_perf_context(struct pmu *pmu, struct task_struct *task) return NULL; __perf_event_init_context(ctx); - if (task) { - ctx->task = task; - get_task_struct(task); - } + if (task) + ctx->task = get_task_struct(task); ctx->pmu = pmu; return ctx; @@ -10355,8 +10353,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, * and we cannot use the ctx information because we need the * pmu before we get a ctx. */ - get_task_struct(task); - event->hw.target = task; + event->hw.target = get_task_struct(task); } event->clock = &local_clock; |