Skip to contentSkip to conversation

perf: Add the rcu_read_lock to protect the list_for_each_entry_rcu.

PATCH New Jun Chen 1 participant 1 message Jan 28, 2013 perf events

lore
Share & tools
lore

Jun Chen

author
#0 lore raw

PATCH 1/1 perf: Add the rcu_read_lock to protect the list_for_each_entry_rcu.

The list_for_each_entry_rcu should be guarded by rcu_read_lock().This patch add rcu_read_lock to protect the list_for_each_entry_rcu.

---
 kernel/events/core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/events/core.c +2 -0
index 301079d..e2f2fa5 100644
@@ -2442,6 +2442,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx,
 
 	raw_spin_lock(&ctx->lock);
 	perf_pmu_disable(ctx->pmu);
+	rcu_read_lock();
 
 	list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
 		if (event->state != PERF_EVENT_STATE_ACTIVE)
@@ -2483,6 +2484,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx,
 		event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
 	}
 
+	rcu_read_unlock();
 	perf_pmu_enable(ctx->pmu);
 	raw_spin_unlock(&ctx->lock);
 }
Signature · 1 line
1.7.4.1