diff options
Diffstat (limited to 'kernel')
-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 ff86c558af4..ac869dc7896 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -1757,7 +1757,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); } |