[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158817741394.748034.9273604089138009552.stgit@buzz>
Date: Wed, 29 Apr 2020 19:23:41 +0300
From: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To: linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Cc: Kan Liang <kan.liang@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Andi Kleen <ak@...ux.intel.com>,
Dmitry Monakhov <dmtrmonakhov@...dex-team.ru>
Subject: [PATCH v2 3/3] perf tool: simplify checking active smt
SMT now could be disabled via "/sys/devices/system/cpu/smt/control".
Status shown in "/sys/devices/system/cpu/smt/active" simply as "0" / "1".
If this knob isn't here then fallback to checking topology as before.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
---
tools/perf/util/smt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/smt.c b/tools/perf/util/smt.c
index dc37b5abd1c3..c398528d1006 100644
--- a/tools/perf/util/smt.c
+++ b/tools/perf/util/smt.c
@@ -19,6 +19,9 @@ int smt_on(void)
if (cached)
return cached_result;
+ if (sysfs__read_int("devices/system/cpu/smt/active", &active) > 0)
+ goto done;
+
ncpu = sysconf(_SC_NPROCESSORS_CONF);
for (cpu = 0; cpu < ncpu; cpu++) {
char fn[256];
@@ -37,6 +40,7 @@ int smt_on(void)
active = str && (strchr(str, ',') != NULL || strchr(str, '-') != NULL);
free(str);
+done:
if (!cached) {
cached_result = active;
cached = true;
Powered by blists - more mailing lists