[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200429181609.GG30487@kernel.org>
Date: Wed, 29 Apr 2020 15:16:09 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
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: Re: [PATCH v2 3/3] perf tool: simplify checking active smt
Em Wed, Apr 29, 2020 at 07:23:41PM +0300, Konstantin Khlebnikov escreveu:
> 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.
I've manually applied this one, thanks, please check my perf/core branch
later before resending 2/3, thanks.
- Arnaldo
> 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;
>
--
- Arnaldo
Powered by blists - more mailing lists