diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2019-07-04 18:13:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-07-25 09:51:54 -0400 |
commit | 7b3c92b85a65c2db1f542265bc98e1f9e3056eba (patch) | |
tree | 14ce7357c1f489793d3989db344d6782e85824f8 /kernel/events | |
parent | 3c29e651e16dd3b3179cfb2d055ee9538e37515c (diff) |
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) | |||
4089 | return NULL; | 4089 | return NULL; |
4090 | 4090 | ||
4091 | __perf_event_init_context(ctx); | 4091 | __perf_event_init_context(ctx); |
4092 | if (task) { | 4092 | if (task) |
4093 | ctx->task = task; | 4093 | ctx->task = get_task_struct(task); |
4094 | get_task_struct(task); | ||
4095 | } | ||
4096 | ctx->pmu = pmu; | 4094 | ctx->pmu = pmu; |
4097 | 4095 | ||
4098 | return ctx; | 4096 | return ctx; |
@@ -10355,8 +10353,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, | |||
10355 | * and we cannot use the ctx information because we need the | 10353 | * and we cannot use the ctx information because we need the |
10356 | * pmu before we get a ctx. | 10354 | * pmu before we get a ctx. |
10357 | */ | 10355 | */ |
10358 | get_task_struct(task); | 10356 | event->hw.target = get_task_struct(task); |
10359 | event->hw.target = task; | ||
10360 | } | 10357 | } |
10361 | 10358 | ||
10362 | event->clock = &local_clock; | 10359 | event->clock = &local_clock; |