Patch "perf metric: Only add a referenced metric once" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf metric: Only add a referenced metric once

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-metric-only-add-a-referenced-metric-once.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit aef9d246aa30dffd392308024c92bde60b7aa63a
Author: Ian Rogers <irogers@xxxxxxxxxx>
Date:   Fri Oct 15 10:21:19 2021 -0700

    perf metric: Only add a referenced metric once
    
    [ Upstream commit a3de76903dd0786a8661e9e6eb9054a7519e10e7 ]
    
    If a metric references other metrics then the same other metrics may be
    referenced more than once, but the events and metric ref are only needed
    once.
    
    An example of this is in tests/parse-metric.c where DCache_L2_Hits
    references the metric DCache_L2_All_Hits twice, once directly and once
    through DCache_L2_All.
    
    Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
    Acked-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Andrew Kilroy <andrew.kilroy@xxxxxxx>
    Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Cc: Changbin Du <changbin.du@xxxxxxxxx>
    Cc: Denys Zagorui <dzagorui@xxxxxxxxx>
    Cc: Fabian Hemmer <copy@xxxxxxx>
    Cc: Felix Fietkau <nbd@xxxxxxxx>
    Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Cc: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
    Cc: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Joakim Zhang <qiangqing.zhang@xxxxxxx>
    Cc: John Garry <john.garry@xxxxxxxxxx>
    Cc: Kajol Jain <kjain@xxxxxxxxxxxxx>
    Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: Kees Kook <keescook@xxxxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Nicholas Fraser <nfraser@xxxxxxxxxxxxxxx>
    Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
    Cc: Paul Clarke <pc@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Riccardo Mancini <rickyman7@xxxxxxxxx>
    Cc: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
    Cc: ShihCheng Tu <mrtoastcheng@xxxxxxxxx>
    Cc: Song Liu <songliubraving@xxxxxx>
    Cc: Stephane Eranian <eranian@xxxxxxxxxx>
    Cc: Sumanth Korikkar <sumanthk@xxxxxxxxxxxxx>
    Cc: Thomas Richter <tmricht@xxxxxxxxxxxxx>
    Cc: Wan Jiabing <wanjiabing@xxxxxxxx>
    Cc: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211015172132.1162559-9-irogers@xxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 2dc2a0dcf846..ec8195f1ab50 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -836,12 +836,18 @@ static int __add_metric(struct list_head *metric_list,
 		*mp = m;
 	} else {
 		/*
-		 * We got here for the referenced metric, via the
-		 * recursive metricgroup__add_metric call, add
-		 * it to the parent group.
+		 * This metric was referenced in a metric higher in the
+		 * tree. Check if the same metric is already resolved in the
+		 * metric_refs list.
 		 */
 		m = *mp;
 
+		list_for_each_entry(ref, &m->metric_refs, list) {
+			if (!strcmp(pe->metric_name, ref->metric_name))
+				return 0;
+		}
+
+		/*Add the new referenced metric to the pare the parent group. */
 		ref = malloc(sizeof(*ref));
 		if (!ref)
 			return -ENOMEM;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux