summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/perf_counter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index eb346048f00f..616c52426b32 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1004,6 +1004,10 @@ static void __perf_counter_task_sched_out(struct perf_counter_context *ctx)
if (!cpuctx->task_ctx)
return;
+
+ if (WARN_ON_ONCE(ctx != cpuctx->task_ctx))
+ return;
+
__perf_counter_sched_out(ctx, cpuctx);
cpuctx->task_ctx = NULL;
}