lkml.org 
[lkml]   [2020]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@yandex-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

\
 
 \ /
  Last update: 2020-04-29 20:17    [W:1.646 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site