Skip to content

Commit 4ffbe87

Browse files
captain5050acmel
authored andcommitted
perf tools: Fix SMT detection fast read path
sysfs__read_int() returns 0 on success, and so the fast read path was always failing. Fixes: bb62948 ("perf tools: Simplify checking if SMT is active.") Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: John Garry <john.garry@huawei.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20211124001231.3277836-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent cba43fc commit 4ffbe87

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/perf/util/smt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int smt_on(void)
1515
if (cached)
1616
return cached_result;
1717

18-
if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) > 0)
18+
if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0)
1919
goto done;
2020

2121
ncpu = sysconf(_SC_NPROCESSORS_CONF);

0 commit comments

Comments
 (0)