diff options
-rw-r--r-- | kernel/perf_event.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 1ec3916ffef..e7eeba1794f 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -1780,7 +1780,13 @@ static u64 perf_event_read(struct perf_event *event) unsigned long flags; raw_spin_lock_irqsave(&ctx->lock, flags); - update_context_time(ctx); + /* + * may read while context is not active + * (e.g., thread is blocked), in that case + * we cannot update context time + */ + if (ctx->is_active) + update_context_time(ctx); update_event_times(event); raw_spin_unlock_irqrestore(&ctx->lock, flags); } |