lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf/core: remove a meaningless pair of rcu_read_{,un}lock()
Date
Per the codes, this pair of rcu_read_{,un}lock() protects nothing.
Let's remove it.

Further, the variable "pmu" is safe as it is in the SRCU read-side
critical scope of "pmus_srcu" and perf_pmu_unregister() delete it
after calling synchronize_srcu.

Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
---
kernel/events/core.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 950b25c3f210..36b0df6feab4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11296,9 +11296,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
}

again:
- rcu_read_lock();
pmu = idr_find(&pmu_idr, type);
- rcu_read_unlock();
if (pmu) {
if (event->attr.type != type && type != PERF_TYPE_RAW &&
!(pmu->capabilities & PERF_PMU_CAP_EXTENDED_HW_TYPE))
--
2.32.0
\
 
 \ /
  Last update: 2022-06-08 11:46    [W:0.059 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site