aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/perf_event.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 1ec3916ffef0..e7eeba1794fd 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1780,7 +1780,13 @@ static u64 perf_event_read(struct perf_event *event)
1780 unsigned long flags; 1780 unsigned long flags;
1781 1781
1782 raw_spin_lock_irqsave(&ctx->lock, flags); 1782 raw_spin_lock_irqsave(&ctx->lock, flags);
1783 update_context_time(ctx); 1783 /*
1784 * may read while context is not active
1785 * (e.g., thread is blocked), in that case
1786 * we cannot update context time
1787 */
1788 if (ctx->is_active)
1789 update_context_time(ctx);
1784 update_event_times(event); 1790 update_event_times(event);
1785 raw_spin_unlock_irqrestore(&ctx->lock, flags); 1791 raw_spin_unlock_irqrestore(&ctx->lock, flags);
1786 } 1792 }