From: Yanfei Xu <yanfei.xu@intel.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH] perf/core: remove a meaningless pair of rcu_read_{,un}lock()
Date: Wed, 8 Jun 2022 17:09:38 +0800 [thread overview]
Message-ID: <20220608090938.2178624-1-yanfei.xu@intel.com> (raw)
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
next reply other threads:[~2022-06-08 9:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 9:09 Yanfei Xu [this message]
2022-06-08 9:43 ` Peter Zijlstra
2022-06-08 15:46 ` Xu, Yanfei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220608090938.2178624-1-yanfei.xu@intel.com \
--to=yanfei.xu@intel.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®