Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2380452rdg; Mon, 16 Oct 2023 02:35:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAGB4rr7Q5mDU9KPFWAxhMxRVrVMhRoF20QAC9o/IoF6VW1MUVnCuFZyr08amvO0Kenngz X-Received: by 2002:a17:902:fa10:b0:1c3:9928:7b28 with SMTP id la16-20020a170902fa1000b001c399287b28mr8002567plb.6.1697448936967; Mon, 16 Oct 2023 02:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697448936; cv=none; d=google.com; s=arc-20160816; b=Uv/yuxo4kmU7USDbhZE8fF2VngKMxipJocxkPolTFDPdgIaMq3oSajVAcASQk0uqu/ ECFiU0Bm98NchGdGTpLTEJspB81EbT+26hnXKicqyXejCESx373WH2Ak+L1nHECIavUa onL2VNdduB3Ljna4cIAlhscklWCjAc/fGw3wOKF2lxBVQTBK5nkEjcaLZMZmPR6XqoTD r2iKY1IBWf6Nfo9v7YUvova2aLRBdadjt6Ki7mg+C3+gUj37vYDP7xUKLDe0h9NsEVir iHzaxnkYHC83pex+K/MEwbHLt5FeBBT/M4v6SYALcGvGG7ChrFb1b1ItFCOmSczGyQ0r qmmw== 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; bh=UVtGbwrmUBonAlqZqJDmAN/ThQuDkkZlwSk03aySS+4=; fh=JXx1mv1fB650HoTkc5GIgpDQ5Ey550GcDyaNZ/s6bYc=; b=oJ5fIBplRSYUVYk9WlQFNpYHA3RRH4zFs3cUeYAscEnT9RHtXg5MYMujZr34oT9ZFA yqDM4/IBk1AwfJvwFAZ1EBQvjqBscSK6jyspoFLE2MN2JB4J2HYSFbp9lwAmvC8jiDtt c8X/mPzAGUAA+RKOmgaT5+Mb5BeIR/wUNLNjLOjDcSXZGh5zpNZsWLEsMojOEpb3/wN2 /i76rGab5Ye3SrLDXs+U8QtK6b434kQzJV3cA5SmJeCGbAz1a7YZLsTI8hZJXCkO3mya lqAjMDOmzz32ysopzwwFs+RpUFfnNNMYnSf65UxiEdTmlBvyGN1mfPkSqQJBelrt2Qs7 jYlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x2-20020a63cc02000000b005a0737404a7si10957633pgf.258.2023.10.16.02.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 02:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 07129807D3F7; Mon, 16 Oct 2023 02:35:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbjJPJfB (ORCPT + 99 others); Mon, 16 Oct 2023 05:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPJfA (ORCPT ); Mon, 16 Oct 2023 05:35:00 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C09D97; Mon, 16 Oct 2023 02:34:58 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S8Bhv13P1z15Npd; Mon, 16 Oct 2023 17:32:15 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 16 Oct 2023 17:34:54 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH] perf pmu: Filter out search events table of software pmu in perf_pmu__lookup() Date: Mon, 16 Oct 2023 09:33:09 +0000 Message-ID: <20231016093309.726436-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 02:35:16 -0700 (PDT) For software pmu, the events_table is empty, reducing unnecessary search. Signed-off-by: Yang Jihong --- tools/perf/util/pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6428e2648289..59c8394a4efa 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1033,7 +1033,8 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char pmu->id = pmu_id(name); pmu->max_precise = pmu_max_precise(dirfd, pmu); pmu->alias_name = pmu_find_alias_name(pmu, dirfd); - pmu->events_table = perf_pmu__find_events_table(pmu); + if (!perf_pmu__is_software(pmu)) + pmu->events_table = perf_pmu__find_events_table(pmu); pmu_add_sys_aliases(pmu); list_add_tail(&pmu->list, pmus); -- 2.34.1