Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2357323iof; Wed, 8 Jun 2022 03:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFPtDDnAinZEO5HPbWyiBLBtrmy8VlqQHfb9YXrKE0fwh8zEDrHP0yjsbz9QfZeqzi9LFV X-Received: by 2002:a17:902:b28b:b0:167:863f:114f with SMTP id u11-20020a170902b28b00b00167863f114fmr12452121plr.90.1654683480505; Wed, 08 Jun 2022 03:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654683480; cv=none; d=google.com; s=arc-20160816; b=yq9FyWX58xb3RlFnTKc2PJpMMawDqhuB1WZrciDK4uRMcNKgV5SKZvA9bLEAZrUiNd yT5bPsLabXjg6HzKYvxwAJvmgayvPr+mQGqESR/EfN7qaAj/QUtvgoAhUhrxk4DA9Y42 oYrlaFEHn3AWK9BroXJKP0CTi6CE4Sr9IU8A81NHBpQPn5zuJmpZneYnb3Q4QNBWfgDJ B+gZ/XxUsFEyKRQB8oYNgu/SPwN4CE+cFOpZ48JZxtKdSsbOqCrzEJbpM31y9QlNmvc2 Wwek1SX6OQnldbeffqwYU60Q/y7d+QBpY/0172PDO23yRYhI55EyP8gMNhi+sRfI3iij UsUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=u9nFHOxZTDo8BLteijuDBX51aob2nssh+0yTmjVPubk=; b=qD/e1wZXohx81LTN9O5vvi6kbHKXejWfLShSuL1emlMtVnrZMoAaeZK3ZxstociabO YaSap74rF+RyMVuENkU0xW64rFV94kq0SZGJArRkcBocQDfNMxRVNmgzLptPZPpEYb34 J8M4rHfMATzRPIWCn4+liYxzOxILtr0D1KUy0QLo6ZdXAUBTDlxbKysSSYfJAR8eRFjH W3rpA9bjx6JRxqzK75+nZqd/2f558WM8QSq8Fh9/A8RN5E9JjxMkciny65fHrYwL4at1 G7FvTwB4dmJ9S95XWn+qRo1TcrO1GPyGulWtUV2hkU9qgDNIBY7rxrf2k4P84AT8Zl6W 3RSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jxqwDbLe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b14-20020a056a000cce00b0050cf84f4e8fsi6603910pfv.29.2022.06.08.03.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 03:18:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jxqwDbLe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 53B7514B648; Wed, 8 Jun 2022 02:44:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235225AbiFHJoL (ORCPT + 99 others); Wed, 8 Jun 2022 05:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235299AbiFHJnm (ORCPT ); Wed, 8 Jun 2022 05:43:42 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C34071BF155; Wed, 8 Jun 2022 02:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654679428; x=1686215428; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eMX2xcf/+FT6Cb05u89O2IkB0tmxuxLjMOtDqe8J9zA=; b=jxqwDbLe2RxKm9sh3UCLnbPpRQIsZxMt4TrK5V3Ttddep/+ayfqZSAeC WSvBnh+1Pkvij4lZueXBBe3n43hdLVvsVQWiz0+tMV7WyzXDXxpkkiK6D sXJK/AyLFSXW1QRL9IhWyUGftXp6Ei8kRH2VOeCJwqpeAdi7Gixo3DCqF tiCMAXmjbuRd/i6m3a9KvN5ZycC9qribtv44zmlwKUcq7GcJDu/LUBwlT oQcD2XwvIg6CDxe4lUEzmY47gk62XwVWuM3xwFYCea+JmvQw7XFS6wS+X Hs3GjPDdYbX0JsOmHJnsrAlvql5nYjGtJOlZvfTYcJBpXmEeY2Usoqan0 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="363158274" X-IronPort-AV: E=Sophos;i="5.91,285,1647327600"; d="scan'208";a="363158274" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 02:10:11 -0700 X-IronPort-AV: E=Sophos;i="5.91,285,1647327600"; d="scan'208";a="636697466" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 02:10:09 -0700 From: Yanfei Xu 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 Message-Id: <20220608090938.2178624-1-yanfei.xu@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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