From nobody Tue Feb 10 06:04:41 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCB63364022 for ; Mon, 9 Feb 2026 09:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629097; cv=none; b=ZYWsXRofldxX40QOT4BydDNsSaYmsqrinpTAmthY/AZcOsC41oXu9tk1XhmPqo/QqwZj3WcVTFyo1DmI27QsPYibpk4SA5XyU+gXdIZ7sRTnJKQ8t5cCejpyrzuauG1vYZGRkDMmOGDQbSzSfX+L5pRZVc2cDFtLYjf2iK+PrPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629097; c=relaxed/simple; bh=TS3My54+1+wB3igxyJXqNn57tpPk9g2oanX93lMf9nc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UbyLxPwoyp6wwmwlsBoM8BasUo4Yey0JwT39jvL1qhZ4Eh+KWWx7wkaNc16XqnunG10SSrOcDF2Lfw7ZoyQY9pS6IVpCumEvo6trBX4W3WSRwujDGJA6zSEZCCOLK5C3qqYyZFSqRrpCUVlFPjqKNBOtyUSzunq/+UBpA5yVJgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CPGxZmNr; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=HZSKOJdz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CPGxZmNr"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="HZSKOJdz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770629095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=st11ylo4z/SO3tLN7S2b9c++GEqcWdO6dyVW8k4qC0Q=; b=CPGxZmNrgvC+sjoPfTKqcVIKJoRS7cj5xrx3VVBBgm0NxI37TKpOPVVZ7RZ9YmwXkAABCm WKlSCyiApAX50bFVOWJtSqgR0uun6z1OoKGfTTleaB0KTA838OB4s5aegtayyTNlX4T8ew 1m2BGtfp33/a5fUhKJqVAOGNKNYcbV8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-GqPPrCzoN5ykglpXN-cbbA-1; Mon, 09 Feb 2026 04:24:54 -0500 X-MC-Unique: GqPPrCzoN5ykglpXN-cbbA-1 X-Mimecast-MFC-AGG-ID: GqPPrCzoN5ykglpXN-cbbA_1770629093 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4831192e66aso38099305e9.2 for ; Mon, 09 Feb 2026 01:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770629093; x=1771233893; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=st11ylo4z/SO3tLN7S2b9c++GEqcWdO6dyVW8k4qC0Q=; b=HZSKOJdzZ/idoYRx4/HZXz+lLCYBxtp891fHPSMJcnMNtpyRSrKb/Nv2WAREBrj8tU E6HJM2p4phHhh9UfZcxr02LlKx4clRQQbiC5OOb7GhrE4qZshFwipI1gO0B+YrYXC5Ni IN6Yuldgp6k+SSFaCR3Xl7VX5CC9ifHG6lEGjl2YQuKgIol8ZqBD7zWnteqvDFM4v74P +mUnIILbYzU9I2CL77EPX6nQ4psJGoECBE78wpH3v6alT+9K63+CQLAghyX9ppc9twGo 1d89zBoHZM391Cwqgz/kbI5scLeTKd6xDj4InpWfRoH1cwDJ7IqD6YVR8h+KJkyahD2p ThSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770629093; x=1771233893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=st11ylo4z/SO3tLN7S2b9c++GEqcWdO6dyVW8k4qC0Q=; b=irJAJF/hPhO1K1YXYi+QVzwFjlna1zIaSCsWoJNGWzkCfk9voSyRWFqBa7s+6mplXp N1LUKXdBMNT1EtOaUWJyp2VIQHMQ2qXHy4lq7cXIJieAcdKHHJC/IJnObSZB8/SU60uT e/8g8KofpkpdvLSnhD5w+5cZzum7XP7B7u1VwSdKbHwaCNoo+wEwNuv/IgMEtAMcHCd2 28ESyc5WzS3684LlGxbhK5p6zJIw3VXYNphJWpWrbqiYf+BdzTNmKdFk1VWPAa9bRlUs QaN7RnFor+Nym3bVJDiRTg2ofXBlSVJNGu5pvc+6MQn0Au49m38vtFAKoDhdmfVVw1TI MWWw== X-Forwarded-Encrypted: i=1; AJvYcCW1Lzs/GjCwCDQhve38Dbb6trXwfN3zhS2iF0yLXxtLmgJi0wIPvd+rqNqxNWILO1UcU0ykY1QanjCnMUE=@vger.kernel.org X-Gm-Message-State: AOJu0YxiohQZwGyvPcg//ktT2NsDvHOtp0g6smym+OTdiQwM+hJh5ipN Gp6UnKosU5Vc9UrH97XTl08i7lRjKJtf5z4L1wcW7MZ4qkNQl06f0fFWpju+KoG2hvXskws0a0s DQFllWvc/B0Zixaeb0MIXMj4cwTOWJml+8QFykpWb/ApyUo8t0eqhJkz3AUqCpZROVw== X-Gm-Gg: AZuq6aKyhA8l5gwlgv050tg5eidBep4woOp6DiWMpeDaKOslNp9RF2rz2kO/lrGTQ/x xfDNwTCclEJ6kNi4BNrKAH6e2iM0CtzIhhOa7XlnwrdfZqddXnl7ML3f4qoI9rSo5NsUlhUhxZW nyMpmQkuGZGJ65R2dPtxSoSXBEv2sblN4E2Bzd5+gdrLGZpuN0FlSfYhj+X9HBimytWbsvoQno3 1wRFRRo/Q+UKDoieLl6/TE0Jf8QTKqKD0DIfLe1oG+DV47rqFjvodTIlOyQgAHYwFrP7UfnaFJS fzmXZAgVZvYkcg3hsy3wefdEu1700ex5c9M2/pehiNHCbXZQoQaZb87RseHek0D7tBkwEFxCvft mcUXfhwnylCEEgvg9Ctw//ifeOQ== X-Received: by 2002:a05:600c:4e86:b0:480:52fd:d2e4 with SMTP id 5b1f17b1804b1-483201710c7mr129388065e9.0.1770629093076; Mon, 09 Feb 2026 01:24:53 -0800 (PST) X-Received: by 2002:a05:600c:4e86:b0:480:52fd:d2e4 with SMTP id 5b1f17b1804b1-483201710c7mr129387715e9.0.1770629092614; Mon, 09 Feb 2026 01:24:52 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d33f5fsm316310295e9.5.2026.02.09.01.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 01:24:52 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 1/4] tools/rtla: Consolidate nr_cpus usage across all tools Date: Mon, 9 Feb 2026 11:24:33 +0200 Message-ID: <20260209092436.2899888-2-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260209092436.2899888-1-costa.shul@redhat.com> References: <20260209092436.2899888-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sysconf(_SC_NPROCESSORS_CONF) (via get_nprocs_conf) reflects cpu_possible_mask, which is fixed at boot time, so querying it repeatedly is unnecessary. Replace multiple calls to sysconf(_SC_NPROCESSORS_CONF) with a single global nr_cpus variable initialized once at startup. `#pragma once` in timerlat_u.h is needed for pre-C23 compilers to avoid redefinition errors. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/common.c | 7 +++++-- tools/tracing/rtla/src/common.h | 2 ++ tools/tracing/rtla/src/osnoise_hist.c | 3 --- tools/tracing/rtla/src/osnoise_top.c | 7 ------- tools/tracing/rtla/src/timerlat.c | 5 +---- tools/tracing/rtla/src/timerlat_aa.c | 1 - tools/tracing/rtla/src/timerlat_hist.c | 3 --- tools/tracing/rtla/src/timerlat_top.c | 7 ------- tools/tracing/rtla/src/timerlat_u.c | 3 +-- tools/tracing/rtla/src/timerlat_u.h | 1 + tools/tracing/rtla/src/utils.c | 10 +--------- 11 files changed, 11 insertions(+), 38 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index ceff76a62a30..e4cf30a65e82 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -5,12 +5,14 @@ #include #include #include -#include #include +#include + #include "common.h" =20 struct trace_instance *trace_inst; volatile int stop_tracing; +int nr_cpus; =20 static void stop_trace(int sig) { @@ -135,7 +137,7 @@ common_apply_config(struct osnoise_tool *tool, struct c= ommon_params *params) } =20 if (!params->cpus) { - for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) + for (i =3D 0; i < nr_cpus; i++) CPU_SET(i, ¶ms->monitored_cpus); } =20 @@ -183,6 +185,7 @@ int run_tool(struct tool_ops *ops, int argc, char *argv= []) bool stopped; int retval; =20 + nr_cpus =3D get_nprocs_conf(); params =3D ops->parse_args(argc, argv); if (!params) exit(1); diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/commo= n.h index 7602c5593ef5..32f9c1351209 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -107,6 +107,8 @@ struct common_params { struct timerlat_u_params user; }; =20 +extern int nr_cpus; + #define for_each_monitored_cpu(cpu, nr_cpus, common) \ for (cpu =3D 0; cpu < nr_cpus; cpu++) \ if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus)) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 9d70ea34807f..03ebff34fff4 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -647,9 +647,6 @@ static struct osnoise_tool *osnoise_init_hist(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("osnoise_hist"); if (!tool) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index d54d47947fb4..7dcd2e318205 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -232,12 +232,8 @@ osnoise_print_stats(struct osnoise_tool *top) { struct osnoise_params *params =3D to_osnoise_params(top->params); struct trace_instance *trace =3D &top->trace; - static int nr_cpus =3D -1; int i; =20 - if (nr_cpus =3D=3D -1) - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - if (!params->common.quiet) clear_terminal(trace->seq); =20 @@ -495,9 +491,6 @@ osnoise_top_apply_config(struct osnoise_tool *tool) struct osnoise_tool *osnoise_init_top(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("osnoise_top"); if (!tool) diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 8f8811f7a13b..69856f677fce 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -99,7 +99,7 @@ timerlat_apply_config(struct osnoise_tool *tool, struct t= imerlat_params *params) int timerlat_enable(struct osnoise_tool *tool) { struct timerlat_params *params =3D to_timerlat_params(tool->params); - int retval, nr_cpus, i; + int retval, i; =20 if (params->dma_latency >=3D 0) { dma_latency_fd =3D set_cpu_dma_latency(params->dma_latency); @@ -115,8 +115,6 @@ int timerlat_enable(struct osnoise_tool *tool) return -1; } =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { if (save_cpu_idle_disable_state(i) < 0) { err_msg("Could not save cpu idle state.\n"); @@ -214,7 +212,6 @@ void timerlat_analyze(struct osnoise_tool *tool, bool s= topped) void timerlat_free(struct osnoise_tool *tool) { struct timerlat_params *params =3D to_timerlat_params(tool->params); - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); int i; =20 timerlat_aa_destroy(); diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/= timerlat_aa.c index 31e66ea2b144..5766d58709eb 100644 --- a/tools/tracing/rtla/src/timerlat_aa.c +++ b/tools/tracing/rtla/src/timerlat_aa.c @@ -1022,7 +1022,6 @@ void timerlat_aa_destroy(void) */ int timerlat_aa_init(struct osnoise_tool *tool, int dump_tasks) { - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); struct timerlat_aa_context *taa_ctx; int retval; =20 diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 4e8c38a61197..841118ed84f2 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -1031,9 +1031,6 @@ static struct osnoise_tool *timerlat_init_hist(struct common_params *params) { struct osnoise_tool *tool; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 tool =3D osnoise_init_tool("timerlat_hist"); if (!tool) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 284b74773c2b..3e395ce4fa9f 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -442,15 +442,11 @@ timerlat_print_stats(struct osnoise_tool *top) struct timerlat_params *params =3D to_timerlat_params(top->params); struct trace_instance *trace =3D &top->trace; struct timerlat_top_cpu summary; - static int nr_cpus =3D -1; int i; =20 if (params->common.aa_only) return; =20 - if (nr_cpus =3D=3D -1) - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - if (!params->common.quiet) clear_terminal(trace->seq); =20 @@ -781,9 +777,6 @@ static struct osnoise_tool *timerlat_init_top(struct common_params *params) { struct osnoise_tool *top; - int nr_cpus; - - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 top =3D osnoise_init_tool("timerlat_top"); if (!top) diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/t= imerlat_u.c index ce68e39d25fd..a569fe7f93aa 100644 --- a/tools/tracing/rtla/src/timerlat_u.c +++ b/tools/tracing/rtla/src/timerlat_u.c @@ -16,7 +16,7 @@ #include #include =20 -#include "utils.h" +#include "common.h" #include "timerlat_u.h" =20 /* @@ -131,7 +131,6 @@ static int timerlat_u_send_kill(pid_t *procs, int nr_cp= us) */ void *timerlat_u_dispatcher(void *data) { - int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); struct timerlat_u_params *params =3D data; char proc_name[128]; int procs_count =3D 0; diff --git a/tools/tracing/rtla/src/timerlat_u.h b/tools/tracing/rtla/src/t= imerlat_u.h index 661511908957..a692331bd1c7 100644 --- a/tools/tracing/rtla/src/timerlat_u.h +++ b/tools/tracing/rtla/src/timerlat_u.h @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#pragma once /* * Copyright (C) 2023 Red Hat Inc, Daniel Bristot de Oliveira */ diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 0da3b2470c31..8cd1b374b035 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -19,7 +19,7 @@ #include #include =20 -#include "utils.h" +#include "common.h" =20 #define MAX_MSG_LENGTH 1024 int config_debug; @@ -119,14 +119,11 @@ int parse_cpu_set(char *cpu_list, cpu_set_t *set) { const char *p; int end_cpu; - int nr_cpus; int cpu; int i; =20 CPU_ZERO(set); =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for (p =3D cpu_list; *p; ) { cpu =3D atoi(p); if (cpu < 0 || (!cpu && *p !=3D '0') || cpu >=3D nr_cpus) @@ -559,7 +556,6 @@ int save_cpu_idle_disable_state(unsigned int cpu) unsigned int nr_states; unsigned int state; int disabled; - int nr_cpus; =20 nr_states =3D cpuidle_state_count(cpu); =20 @@ -567,7 +563,6 @@ int save_cpu_idle_disable_state(unsigned int cpu) return 0; =20 if (saved_cpu_idle_disable_state =3D=3D NULL) { - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); saved_cpu_idle_disable_state =3D calloc(nr_cpus, sizeof(unsigned int *)); if (!saved_cpu_idle_disable_state) return -1; @@ -644,13 +639,10 @@ int restore_cpu_idle_disable_state(unsigned int cpu) void free_cpu_idle_disable_states(void) { int cpu; - int nr_cpus; =20 if (!saved_cpu_idle_disable_state) return; =20 - nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); - for (cpu =3D 0; cpu < nr_cpus; cpu++) { free(saved_cpu_idle_disable_state[cpu]); saved_cpu_idle_disable_state[cpu] =3D NULL; --=20 2.52.0 From nobody Tue Feb 10 06:04:41 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59F7363C4D for ; Mon, 9 Feb 2026 09:25:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629105; cv=none; b=KVlpXkqrTj4fOCfExxbbMggbeKh9CZHPcxXhSPYrZeqMUeurBpOAodih22vuHxjMM+OSBastonTHG+5/oRzXC5Y+RYwEfP5PvQhj8cmtSWGi4fcy60oexGgY/VLMAk/ZSdNRp5q3nnO7y3PqAuumgvEpgmDG0qr7AmBUXMga2eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629105; c=relaxed/simple; bh=0GS+sGsKXEzx+jNnjrXhGcR2pmtCanW/2A8zyqvNC+o=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VmMiiZL3NwxRctlDcCPLsfCMwuTSGTJ++rH+Yq2ybicoo7eEBmTIFbXWW31nB1OIjFoCURifWj5rtKimzjr2G4PRBP1GzYmrdnsg1P1w3ZRxDiXvP0yR5wgRhWroY5qNdyDjqfcK8X/QOFSwboW1s52kCBGiBVwRkxCe7Kqqw5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ePc2rX1f; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=QtgZcJtO; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ePc2rX1f"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="QtgZcJtO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770629103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=brymhXOpcI8ZGOoB0rH9K+9PTJHbZxRRnQAyHzspC9M=; b=ePc2rX1fkFmluZSCr4JFuRK3PHEQZsF+rbzknVNvz7pRwVh5kL77Ng4SJiC7TiJ2Ka0TL9 1yT428UWfQ4IRAAjnjGpoj13a2MlpAJZrDtQhLSVpZkwSpd11KHEqYMSVE10uoya81CrZA U4aYoEMp80rNJiOe3HiDkULKF9AtTWU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-656--QFxce4WMx-xppVT3KwS1A-1; Mon, 09 Feb 2026 04:25:02 -0500 X-MC-Unique: -QFxce4WMx-xppVT3KwS1A-1 X-Mimecast-MFC-AGG-ID: -QFxce4WMx-xppVT3KwS1A_1770629101 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4806b12ad3fso43503885e9.0 for ; Mon, 09 Feb 2026 01:25:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770629101; x=1771233901; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=brymhXOpcI8ZGOoB0rH9K+9PTJHbZxRRnQAyHzspC9M=; b=QtgZcJtOZxMRAJKkzenNud1JcUhiKJJSTVH4+UHtIfi4Cvv2vEjOwPiJSbGDhEDud0 xvWarobtsz1dmKFtqIHQTkIAmYZa97+0nCo8bNerCC3fOCJzT7odtxGQfsvH7TCv1MJI eAM15DHwECd3cr3G++v97vfsBnZOvzTccIeoAt9w9lJOGxGLcUyMhVWXTNeCYkod0atz qXksHDFrXVdbCpf0Zn65H0QvcRDaXtOVsCCxLX0U+KAT/kpDwqxLscdcDOq47rvAEizh lcU6GYpcmgygq+LawfSxJdi+Txn7hLCCw6T5iWs/G5nhozzUye2ipDJTDQhxdZz1NI39 /neg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770629101; x=1771233901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=brymhXOpcI8ZGOoB0rH9K+9PTJHbZxRRnQAyHzspC9M=; b=utXRHMQJlm1P26lJElnlgVht/AIsqsmDgxZyid5F4uN1c9QWkg94CqAU8g6UzsEF7c MERTyUOEcGBf9rRA3QGqs5jZh5mnzfGwE7x3r18mq55ZnEWDqTWCMOEPXnZxAK2wZHjz DnVKi58YkcORziiVp/zXI8+hRzf0KOln3Sh4svPVsMkCN/kxtdcfAgpJJnVrLZ9D9HLF G+xoaizNRTtm7r91McnwVyRP+NwgcvMtRPVkJ7+wstYYe6ofeX9s7w9aONmrHLLb9Yy+ S6RtPnD30MQ1hH8GP7YXpmIZ+71fQ+0z3OQVeAVd9darxG33fOoT3e3oUMqbFFds8zyV YjBg== X-Forwarded-Encrypted: i=1; AJvYcCVYPaJ6Atn8TWxqkiZTyRSAuDCEBB2dhl5t6cKuztJpmUYUQWVxYpmq9UJZ5BnowbEwEtvRRJJqVQKyc9M=@vger.kernel.org X-Gm-Message-State: AOJu0YwwAPej5yVQD8OeIMbxuNUQntEm/AiUq1qHD93eDEdON5Fl5sHO Ci7tiab77efdwT+fl/PCOWfj6azAgVV+wmRU+IbMKZOu4Z/o82WTDu2W2Ca3LLsLRoVN3V/wvNH iXl7IUfe4TGEOD/w2aAr9WuN8pzsvgHgKgCGcJYPCMYf6KM9Aydt3OG1wYSOHDY+xWA== X-Gm-Gg: AZuq6aL+CfScsLGf05T3E5euaFASwLfZzXb9pBP10aRqXi2O/QKsV5sul5p1Rhq+G7z TE8hIodBWSHTE/XdRG83E7VrXDA2QF5IUZIegmFq8XgeXDznST+ov09HPykvwJ7cbYadN8LOide m//gnA7l3UUvSQV2FSeWrvGfRM1wQilYo2KKJ+ebNg5BzR6wbUfbbcSsqAITRHNOKuuJ03uPSip 0NCIJOGRdRl5JIHmTxgl1iZvvkMDRXPbgM5OkwDFUBbt0AqyCup1JCIi3ldzuPE8l+eXs2/E+68 3mcaGffuXjW88Genkwg26ba6pPEmNvcB5Xf0eqdn1SCe/IWz7xYL362BePf4ySrMk6yPuwGHhlI xcyr+dVjuv4qqsi7iGiyrPAXN+w== X-Received: by 2002:a05:600c:5488:b0:480:1e8f:d15f with SMTP id 5b1f17b1804b1-483201d5fa2mr138959895e9.2.1770629100991; Mon, 09 Feb 2026 01:25:00 -0800 (PST) X-Received: by 2002:a05:600c:5488:b0:480:1e8f:d15f with SMTP id 5b1f17b1804b1-483201d5fa2mr138959655e9.2.1770629100577; Mon, 09 Feb 2026 01:25:00 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d33f5fsm316310295e9.5.2026.02.09.01.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 01:25:00 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 2/4] tools/rtla: Remove unneeded nr_cpus arguments Date: Mon, 9 Feb 2026 11:24:34 +0200 Message-ID: <20260209092436.2899888-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260209092436.2899888-1-costa.shul@redhat.com> References: <20260209092436.2899888-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nr_cpus does not change at runtime, so passing it through function arguments is unnecessary. Use the global nr_cpus instead of propagating it via parameters. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 4 ++-- tools/tracing/rtla/src/osnoise_top.c | 4 ++-- tools/tracing/rtla/src/timerlat_bpf.c | 5 ++--- tools/tracing/rtla/src/timerlat_bpf.h | 6 ++---- tools/tracing/rtla/src/timerlat_hist.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_top.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_u.c | 6 +++--- 7 files changed, 25 insertions(+), 38 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 03ebff34fff4..d83ee047a5f5 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -62,7 +62,7 @@ static void osnoise_free_hist_tool(struct osnoise_tool *t= ool) * osnoise_alloc_histogram - alloc runtime data */ static struct osnoise_hist_data -*osnoise_alloc_histogram(int nr_cpus, int entries, int bucket_size) +*osnoise_alloc_histogram(int entries, int bucket_size) { struct osnoise_hist_data *data; int cpu; @@ -652,7 +652,7 @@ static struct osnoise_tool if (!tool) return NULL; =20 - tool->data =3D osnoise_alloc_histogram(nr_cpus, params->hist.entries, + tool->data =3D osnoise_alloc_histogram(params->hist.entries, params->hist.bucket_size); if (!tool->data) goto out_err; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 7dcd2e318205..73b3ac0dd43b 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -51,7 +51,7 @@ static void osnoise_free_top_tool(struct osnoise_tool *to= ol) /* * osnoise_alloc_histogram - alloc runtime data */ -static struct osnoise_top_data *osnoise_alloc_top(int nr_cpus) +static struct osnoise_top_data *osnoise_alloc_top(void) { struct osnoise_top_data *data; =20 @@ -496,7 +496,7 @@ struct osnoise_tool *osnoise_init_top(struct common_par= ams *params) if (!tool) return NULL; =20 - tool->data =3D osnoise_alloc_top(nr_cpus); + tool->data =3D osnoise_alloc_top(); if (!tool->data) { osnoise_destroy_tool(tool); return NULL; diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src= /timerlat_bpf.c index 05adf18303df..8d5c3a095e41 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -191,13 +191,12 @@ int timerlat_bpf_get_hist_value(int key, int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return get_value(bpf->maps.summary_irq, bpf->maps.summary_thread, bpf->maps.summary_user, - key, value_irq, value_thread, value_user, cpus); + key, value_irq, value_thread, value_user, nr_cpus); } =20 /* diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index 169abeaf4363..f4a5476f2abb 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -28,8 +28,7 @@ int timerlat_bpf_get_hist_value(int key, int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus); + long long *value_user); int timerlat_load_bpf_action_program(const char *program_path); static inline int have_libbpf_support(void) { return 1; } #else @@ -53,8 +52,7 @@ static inline int timerlat_bpf_get_hist_value(int key, static inline int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return -1; } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 841118ed84f2..dee5fbf622c3 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -83,7 +83,7 @@ static void timerlat_free_histogram_tool(struct osnoise_t= ool *tool) * timerlat_alloc_histogram - alloc runtime data */ static struct timerlat_hist_data -*timerlat_alloc_histogram(int nr_cpus, int entries, int bucket_size) +*timerlat_alloc_histogram(int entries, int bucket_size) { struct timerlat_hist_data *data; int cpu; @@ -223,8 +223,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_COUNT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -234,8 +233,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MIN, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -245,8 +243,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MAX, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -256,8 +253,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_SUM, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -267,8 +263,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_OVERFLOW, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -1036,7 +1031,7 @@ static struct osnoise_tool if (!tool) return NULL; =20 - tool->data =3D timerlat_alloc_histogram(nr_cpus, params->hist.entries, + tool->data =3D timerlat_alloc_histogram(params->hist.entries, params->hist.bucket_size); if (!tool->data) goto out_err; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 3e395ce4fa9f..25b4d81b4fe0 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -62,7 +62,7 @@ static void timerlat_free_top_tool(struct osnoise_tool *t= ool) /* * timerlat_alloc_histogram - alloc runtime data */ -static struct timerlat_top_data *timerlat_alloc_top(int nr_cpus) +static struct timerlat_top_data *timerlat_alloc_top(void) { struct timerlat_top_data *data; int cpu; @@ -196,8 +196,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_CURRENT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -207,8 +206,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_COUNT, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -218,8 +216,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MIN, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -229,8 +226,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_MAX, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -240,8 +236,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) } =20 err =3D timerlat_bpf_get_summary_value(SUMMARY_SUM, - value_irq, value_thread, value_user, - data->nr_cpus); + value_irq, value_thread, value_user); if (err) return err; for (i =3D 0; i < data->nr_cpus; i++) { @@ -782,7 +777,7 @@ static struct osnoise_tool if (!top) return NULL; =20 - top->data =3D timerlat_alloc_top(nr_cpus); + top->data =3D timerlat_alloc_top(); if (!top->data) goto out_err; =20 diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/t= imerlat_u.c index a569fe7f93aa..03b4e68e8b1e 100644 --- a/tools/tracing/rtla/src/timerlat_u.c +++ b/tools/tracing/rtla/src/timerlat_u.c @@ -99,7 +99,7 @@ static int timerlat_u_main(int cpu, struct timerlat_u_par= ams *params) * * Return the number of processes that received the kill. */ -static int timerlat_u_send_kill(pid_t *procs, int nr_cpus) +static int timerlat_u_send_kill(pid_t *procs) { int killed =3D 0; int i, retval; @@ -169,7 +169,7 @@ void *timerlat_u_dispatcher(void *data) =20 /* parent */ if (pid =3D=3D -1) { - timerlat_u_send_kill(procs, nr_cpus); + timerlat_u_send_kill(procs); debug_msg("Failed to create child processes"); pthread_exit(&retval); } @@ -196,7 +196,7 @@ void *timerlat_u_dispatcher(void *data) sleep(1); } =20 - timerlat_u_send_kill(procs, nr_cpus); + timerlat_u_send_kill(procs); =20 while (procs_count) { pid =3D waitpid(-1, &wstatus, 0); --=20 2.52.0 From nobody Tue Feb 10 06:04:41 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E16436402D for ; Mon, 9 Feb 2026 09:25:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629108; cv=none; b=mzoFGUF6nIN/VT3HSC96Ug3w9oclkNfJUqvIfrQL6vXTpaDPTkwxy0vH3bYDMXuzYK5sFaEOoN5xJDILKeSK0EaC7NCvN4h1cyZYnWJ8HSum/J8/07a3NE7fdSLp0cbLypquaNo3mzWavcjikHbghT2E/Db5Fw9eaG0myJ6pFSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629108; c=relaxed/simple; bh=w5dKFS5R1t7rYrQ20YIX0+7bdom2BHUqpe/9dlSUrLY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ItEDWewg0NXNB40Z8n09tAosb9z0zP7AwxDeLYmjAYaQus1cRLJ0EiCBml1/krp66JkPVvxIpYdj9H906e0xk/es/P8y6oCXtpMuaracq6RA0OHn/TGAsJINN9NnAR5ckFCYBPdc8kiW3yqb0i8PQw3QfDHo0RUq2Bdcqwpk+qM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YGDN69Vi; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Yy7hqXDZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YGDN69Vi"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yy7hqXDZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770629107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kx32wyrFkPDhCGYWgA3ZxyjG0SxAKZ8Fjt/kqUocyos=; b=YGDN69ViyF3UN1BggnKGjeNtAqym0L6LfjHZ4K2932VsZP/C2ltuBYwdQEm1OB+lVximzG MgpqINF+Hp7btW/0SFvemwZmxnJAIKa/D9cizJH88zzwnuL96Molz14iBi5MUe+ljyZ+rP jRwNgPAL4D3uzfqT8iJNORjTny13ons= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-fq5uXuLlNYqGOpNAoZ5Ezg-1; Mon, 09 Feb 2026 04:25:06 -0500 X-MC-Unique: fq5uXuLlNYqGOpNAoZ5Ezg-1 X-Mimecast-MFC-AGG-ID: fq5uXuLlNYqGOpNAoZ5Ezg_1770629105 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-480711d09f1so49326925e9.0 for ; Mon, 09 Feb 2026 01:25:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770629105; x=1771233905; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Kx32wyrFkPDhCGYWgA3ZxyjG0SxAKZ8Fjt/kqUocyos=; b=Yy7hqXDZ38BLWSUtUiKabOyBtoKoUhaCEefEp6eXCfLN32nysyuJq2wVCpqTaB/8t7 /4yJlD14trnZfjkHOdn7wtWbgAmUeZS4Fr7j8WWJaoX5YHmbGgvYeG9sxmTF1y6t88Sz uaBhN9EyFg7gumpbIKJQmEJpIsZQxmMyOauzulbxo8PwrZVamcnYp91VZz8bNwMbk/vm eZRLeEr3m7NIX/6Rs0qJI+QUot0sxKt5qGE+AeJp9ZJgUwWpg/emCsYUIzNWu03OsmNW PU4MeQG/NrsyOxBf8cewZp9Vls0cd8qY/S5Ef9aZjBzlHId1XFyshXACMVTxDNU+1NIF uIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770629105; x=1771233905; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Kx32wyrFkPDhCGYWgA3ZxyjG0SxAKZ8Fjt/kqUocyos=; b=JuI6jusA8YCSx2BhWJaPRjhwtrocdxW9bDhZ4/Es1o3CDhalu0xhILVLqOCSy90YUj 38AKUGlGWHHY7q28sv0D2GLxjQd01EJXZMh4CLx1wPWPPc3s+YnGHUx6k+3d9rm/wtCK FvptfHImJgONgXbSuM9vtmkx3LIzHqEbwXJpK7g1rtjiiqC8JWz83rYZ31TI8tcXGy+w DgMG/oaQHglWV0sQuDMqfqd1PeOGdx0HHcVLQ8JXP3yIM699S9/zkif5SdMMeB4rXec2 M9eAJtKi0tveTRunv0UImI9vf4lVRACPNlMl7OJghdD9hZMxgssU4UEb5jDUeg5wqBGe M8FA== X-Forwarded-Encrypted: i=1; AJvYcCWdrJKbILbIc1GrFQYAfa8Mb2vMYJzKHd5SxvAe1/dSZOktIP3PRH9955lZ87QRXY3qmzmf3DpXWWD4gig=@vger.kernel.org X-Gm-Message-State: AOJu0YxEjmiConm15+/8NcaXsAEzO4/RkN1dsEgNP895ANU7+ovNRMuH PeyFMXEeMRI2U1/PaeENbnXYrDnJz1wooPgZjIPhQl24CN72Qb+fF+6K3fidKoH2wiZh+EYfbjo 5X1EPLLAX3jgaRn8ps+rcjrMS0pquEdVWSLC92bkrcdnvbWOhy3oVg3wMscm8DSozkA== X-Gm-Gg: AZuq6aJ1EeQF4Q9UKgEqpJHjvKLCNIaGzQ1tPn+0FnmTroUh8Vpz8oXhfXP5lcH8ql/ LFiPnD8ZcwVh++UlL3TZEj7Aw7T1co2PuEshmnmMHvrkXHK3ScbKIX/8b4b4L9cq3ecjhMUbik/ ZyLq/JTRjxSyNEsJy6sdKVXNf6eTDMHj/6c3qt5M4XIu8yL2iE8YSzzeHw+vzFduYuKnMJX1OeZ 81Bav+kNI/7aw8WKfNeEugoGlyuOLUYQ62iLYbVdqXRxeU8XFym8OdHWbOyQrj2b9UJXITAURLl Uwv22EaFCjXsLCdXFe76QykrTSfP48w0xfJTdQr1gxGVCdeY3so75boFoK/FhGmG9bSuwpDHLd9 y2tbjlBkSuE5XddcCN8+GWQygGg== X-Received: by 2002:a05:600c:1d16:b0:483:1ed8:75d4 with SMTP id 5b1f17b1804b1-483201effc4mr139203025e9.15.1770629104717; Mon, 09 Feb 2026 01:25:04 -0800 (PST) X-Received: by 2002:a05:600c:1d16:b0:483:1ed8:75d4 with SMTP id 5b1f17b1804b1-483201effc4mr139202545e9.15.1770629104111; Mon, 09 Feb 2026 01:25:04 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d33f5fsm316310295e9.5.2026.02.09.01.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 01:25:03 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 3/4] tools/rtla: Remove unneeded nr_cpus members Date: Mon, 9 Feb 2026 11:24:35 +0200 Message-ID: <20260209092436.2899888-4-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260209092436.2899888-1-costa.shul@redhat.com> References: <20260209092436.2899888-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nr_cpus does not change at runtime, so keeping it in struct members is unnecessary. Use the global nr_cpus instead of struct members. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 18 ++++++------ tools/tracing/rtla/src/osnoise_top.c | 3 -- tools/tracing/rtla/src/timerlat_aa.c | 10 +++---- tools/tracing/rtla/src/timerlat_hist.c | 40 ++++++++++++-------------- tools/tracing/rtla/src/timerlat_top.c | 19 ++++++------ 5 files changed, 39 insertions(+), 51 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index d83ee047a5f5..90291504a1aa 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -29,7 +29,6 @@ struct osnoise_hist_data { struct osnoise_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; =20 /* @@ -41,7 +40,7 @@ osnoise_free_histogram(struct osnoise_hist_data *data) int cpu; =20 /* one histogram for IRQ and one for thread, per CPU */ - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].samples) free(data->hist[cpu].samples); } @@ -73,7 +72,6 @@ static struct osnoise_hist_data =20 data->entries =3D entries; data->bucket_size =3D bucket_size; - data->nr_cpus =3D nr_cpus; =20 data->hist =3D calloc(1, sizeof(*data->hist) * nr_cpus); if (!data->hist) @@ -246,7 +244,7 @@ static void osnoise_hist_header(struct osnoise_tool *to= ol) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -275,7 +273,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -287,7 +285,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -300,7 +298,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -316,7 +314,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -351,7 +349,7 @@ osnoise_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -387,7 +385,7 @@ osnoise_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 73b3ac0dd43b..6fb3e72d74f2 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -31,7 +31,6 @@ struct osnoise_top_cpu { =20 struct osnoise_top_data { struct osnoise_top_cpu *cpu_data; - int nr_cpus; }; =20 /* @@ -59,8 +58,6 @@ static struct osnoise_top_data *osnoise_alloc_top(void) if (!data) return NULL; =20 - data->nr_cpus =3D nr_cpus; - /* one set of histograms per CPU */ data->cpu_data =3D calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/= timerlat_aa.c index 5766d58709eb..59b219a1503e 100644 --- a/tools/tracing/rtla/src/timerlat_aa.c +++ b/tools/tracing/rtla/src/timerlat_aa.c @@ -102,7 +102,6 @@ struct timerlat_aa_data { * The analysis context and system wide view */ struct timerlat_aa_context { - int nr_cpus; int dump_tasks; =20 /* per CPU data */ @@ -738,7 +737,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_= thresh) irq_thresh =3D irq_thresh * 1000; thread_thresh =3D thread_thresh * 1000; =20 - for (cpu =3D 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { taa_data =3D timerlat_aa_get_data(taa_ctx, cpu); =20 if (irq_thresh && taa_data->tlat_irq_latency >=3D irq_thresh) { @@ -766,7 +765,7 @@ void timerlat_auto_analysis(int irq_thresh, int thread_= thresh) =20 printf("\n"); printf("Printing CPU tasks:\n"); - for (cpu =3D 0; cpu < taa_ctx->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { taa_data =3D timerlat_aa_get_data(taa_ctx, cpu); tep =3D taa_ctx->tool->trace.tep; =20 @@ -792,7 +791,7 @@ static void timerlat_aa_destroy_seqs(struct timerlat_aa= _context *taa_ctx) if (!taa_ctx->taa_data) return; =20 - for (i =3D 0; i < taa_ctx->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { taa_data =3D timerlat_aa_get_data(taa_ctx, i); =20 if (taa_data->prev_irqs_seq) { @@ -842,7 +841,7 @@ static int timerlat_aa_init_seqs(struct timerlat_aa_con= text *taa_ctx) struct timerlat_aa_data *taa_data; int i; =20 - for (i =3D 0; i < taa_ctx->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { =20 taa_data =3D timerlat_aa_get_data(taa_ctx, i); =20 @@ -1031,7 +1030,6 @@ int timerlat_aa_init(struct osnoise_tool *tool, int d= ump_tasks) =20 __timerlat_aa_ctx =3D taa_ctx; =20 - taa_ctx->nr_cpus =3D nr_cpus; taa_ctx->tool =3D tool; taa_ctx->dump_tasks =3D dump_tasks; =20 diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index dee5fbf622c3..4bf1489cad23 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -44,7 +44,6 @@ struct timerlat_hist_data { struct timerlat_hist_cpu *hist; int entries; int bucket_size; - int nr_cpus; }; =20 /* @@ -56,7 +55,7 @@ timerlat_free_histogram(struct timerlat_hist_data *data) int cpu; =20 /* one histogram for IRQ and one for thread, per CPU */ - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { + for (cpu =3D 0; cpu < nr_cpus; cpu++) { if (data->hist[cpu].irq) free(data->hist[cpu].irq); =20 @@ -94,7 +93,6 @@ static struct timerlat_hist_data =20 data->entries =3D entries; data->bucket_size =3D bucket_size; - data->nr_cpus =3D nr_cpus; =20 /* one set of histograms per CPU */ data->hist =3D calloc(1, sizeof(*data->hist) * nr_cpus); @@ -204,17 +202,17 @@ static int timerlat_hist_bpf_pull_data(struct osnoise= _tool *tool) { struct timerlat_hist_data *data =3D tool->data; int i, j, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; =20 /* Pull histogram */ for (i =3D 0; i < data->entries; i++) { err =3D timerlat_bpf_get_hist_value(i, value_irq, value_thread, - value_user, data->nr_cpus); + value_user, nr_cpus); if (err) return err; - for (j =3D 0; j < data->nr_cpus; j++) { + for (j =3D 0; j < nr_cpus; j++) { data->hist[j].irq[i] =3D value_irq[j]; data->hist[j].thread[i] =3D value_thread[j]; data->hist[j].user[i] =3D value_user[j]; @@ -226,7 +224,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].irq_count =3D value_irq[i]; data->hist[i].thread_count =3D value_thread[i]; data->hist[i].user_count =3D value_user[i]; @@ -236,7 +234,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].min_irq =3D value_irq[i]; data->hist[i].min_thread =3D value_thread[i]; data->hist[i].min_user =3D value_user[i]; @@ -246,7 +244,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].max_irq =3D value_irq[i]; data->hist[i].max_thread =3D value_thread[i]; data->hist[i].max_user =3D value_user[i]; @@ -256,7 +254,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].sum_irq =3D value_irq[i]; data->hist[i].sum_thread =3D value_thread[i]; data->hist[i].sum_user =3D value_user[i]; @@ -266,7 +264,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->hist[i].irq[data->entries] =3D value_irq[i]; data->hist[i].thread[data->entries] =3D value_thread[i]; data->hist[i].user[data->entries] =3D value_user[i]; @@ -300,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *t= ool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -352,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -374,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -402,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -430,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -475,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params, sum.min_thread =3D ~0; sum.min_user =3D ~0; =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -622,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -660,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 25b4d81b4fe0..4eb820fe1f21 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -41,7 +41,6 @@ struct timerlat_top_cpu { =20 struct timerlat_top_data { struct timerlat_top_cpu *cpu_data; - int nr_cpus; }; =20 /* @@ -71,8 +70,6 @@ static struct timerlat_top_data *timerlat_alloc_top(void) if (!data) return NULL; =20 - data->nr_cpus =3D nr_cpus; - /* one set of histograms per CPU */ data->cpu_data =3D calloc(1, sizeof(*data->cpu_data) * nr_cpus); if (!data->cpu_data) @@ -190,16 +187,16 @@ static int timerlat_top_bpf_pull_data(struct osnoise_= tool *tool) { struct timerlat_top_data *data =3D tool->data; int i, err; - long long value_irq[data->nr_cpus], - value_thread[data->nr_cpus], - value_user[data->nr_cpus]; + long long value_irq[nr_cpus], + value_thread[nr_cpus], + value_user[nr_cpus]; =20 /* Pull summary */ err =3D timerlat_bpf_get_summary_value(SUMMARY_CURRENT, value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].cur_irq =3D value_irq[i]; data->cpu_data[i].cur_thread =3D value_thread[i]; data->cpu_data[i].cur_user =3D value_user[i]; @@ -209,7 +206,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].irq_count =3D value_irq[i]; data->cpu_data[i].thread_count =3D value_thread[i]; data->cpu_data[i].user_count =3D value_user[i]; @@ -219,7 +216,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].min_irq =3D value_irq[i]; data->cpu_data[i].min_thread =3D value_thread[i]; data->cpu_data[i].min_user =3D value_user[i]; @@ -229,7 +226,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].max_irq =3D value_irq[i]; data->cpu_data[i].max_thread =3D value_thread[i]; data->cpu_data[i].max_user =3D value_user[i]; @@ -239,7 +236,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_to= ol *tool) value_irq, value_thread, value_user); if (err) return err; - for (i =3D 0; i < data->nr_cpus; i++) { + for (i =3D 0; i < nr_cpus; i++) { data->cpu_data[i].sum_irq =3D value_irq[i]; data->cpu_data[i].sum_thread =3D value_thread[i]; data->cpu_data[i].sum_user =3D value_user[i]; --=20 2.52.0 From nobody Tue Feb 10 06:04:41 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A5FC3624DE for ; Mon, 9 Feb 2026 09:25:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629111; cv=none; b=s90SodzyD1lefOQjKjbZSEWg1OGhu9Wz5XfQs8j+4Aw0JQsAX6rz1wQ4GjF1qVeapp34FCAJVFkLhYFz+dM64Sk9QI8N/Xiv4I7nx0DGwbEnsqMUkRQxKEa2MuWd/XFyj2UzynA+9zgOsba3XE0TpQ1CAyOcsVpRAVHSoJ79CEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770629111; c=relaxed/simple; bh=jXM6h73fi/T1NI6sc5NlsOcr2JeACiIlmwKPddXhEyc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jaryT5olBvaZSvA3xNAJQymRCo24gwqbnFV9KaFfpufw1YcrMykLcm+NuzPfCvDqB202/t8qZVi0pKaFGR/ZfpqSVd1ay+5w8iygt31h9L8aMQ81BZdF33qonR3Fkmbr9ETG26+GcwePn9gO7sFJm8nMX8m07lkmtQgpFsy5+v0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=T3/Zzoaj; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=LPHBb2wl; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T3/Zzoaj"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="LPHBb2wl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770629110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrzntSVggQfVgXA1EfIrnMrsyGocXfN5hLyeRmwcLd0=; b=T3/ZzoajpQqp5M/+ui8wdZ1QUx8L1UbO4vFlxydB5qKd2mbp2vQzSTaEydpIMBcKC6vKNx vLJQj4dS2qCe0MqxaKeO/O2vIQ7idPDVHCOmnPAPtQyCTFnAX1HWVMBw0NaHw+i3jkPusw b+k/Ux6jkQONHc7hMldzVgLAkDTcvWY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-AQsXbkOFMwKJArkU9zyYNw-1; Mon, 09 Feb 2026 04:25:08 -0500 X-MC-Unique: AQsXbkOFMwKJArkU9zyYNw-1 X-Mimecast-MFC-AGG-ID: AQsXbkOFMwKJArkU9zyYNw_1770629107 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-482d8e6e13aso31315135e9.3 for ; Mon, 09 Feb 2026 01:25:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770629107; x=1771233907; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vrzntSVggQfVgXA1EfIrnMrsyGocXfN5hLyeRmwcLd0=; b=LPHBb2wlvzHU2pUC8e1YUSCfikI3hstMcfZt6H946JzTHCxq8Dekf6czPHbl+Hc119 E16+eo741ivzeGFOcHC7D7sBYuWos1lECSj09hNum9HG3BmJTLwJUrZLYUNIA5qOMmNT NskLh01RN9j635jOdTlNaA6R85AzyDnxr3yjgA/kT6GTA8HQ/Y65hYPq1uV7lyKP3j2u 0CcyoeGetKPN5lX46GYa4ZjU84K/agg5sDs9mdS/ZoUMdAbNFl2BL2U9r7C8ZaQMF7Ki VHm0TFGjzL3FhEjxD1VasFejZ4sLMYnrIST7D/G/WCS24sdcokfMOdkjKEGSXdu4CWX5 c4yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770629107; x=1771233907; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vrzntSVggQfVgXA1EfIrnMrsyGocXfN5hLyeRmwcLd0=; b=kwL+lert5Vhpxo26zf7fnOs7oKsUmlDVVUxIfXSgOcAZxOWGRK8GxYGAzfkKNKoYKO btnhSg3lWzQFEqgHPWxd4nJg9MNpe7ngw5VOKF33TQWsOZyWBOlckRxqCZeUsH0eYezt oJkvBl0HRbqJa3bgNfB8EXtbggijFrb0Fw3RvFoQk3LgTFDej0SITYJ+xZCbay6wTSE7 /h5YPFapLsMSZO+0Obaz7GnC5MZ8mpPHKzv2gyBwOFgKZH+5DN83ipKPh6E2dGqTh4rz EFe8ouVBb0Kyeci6HNuoGSyJWIq2cqIDNzlLU3xgFt4klA5ZADmGvjB0dYIZMQaV5PjQ hR0g== X-Forwarded-Encrypted: i=1; AJvYcCUrz0Fx2PTjgZ3/IZfJ5s9S4ahFO9WsJrU3I3MKuRRBh77zl9F6owkuKkdy9jc9nAGIFuacF1xzEFKEK0U=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0we738MjxByEMTMPQeXNEVlBoOvgvZG+ZBStQHT74MqaK+Mkq 34r8FO4YYQZ5jU3Vg8zYtjNf91wafe9lF3IThrNvxvf0GlWTarb0iWY5rdXU/tu7U0/Tn8Ht6kF 20v0OuglQHd27Psp3g2Io1ZQL5Z1hX08pGqYPL4Bt5T6VLNZ3lE0WJ9Ixj8qjVFq2YA== X-Gm-Gg: AZuq6aLlKeB1Udg08B09CSnfIfaEv5nZfNoWJ76fZA+bn4FvFf88eyGoFu4sN05iKFK p7pc0EbK51inkq8RECWK9gF7idUgDDQWDdlBaRqk64/t4XH2DzX+3GGt0SEI+lNCkREz5ntUvnt QwZ/c+RalbggBPXRmUyQQNqSo+85DCy/PX0OvULvcGLOHW36dzVL5pxGo+VmLS2E9V3wNtDfvxE qf2Wk4arQo/h690UGEkpV3BugZfhBGUmQKVCTyodYOS4R3d8EJOLsBybus3pgDMyVu6uChW9l0u 7Ea5Lv0/pbpm/NzMEhVuayev2mPCT/Yqy0G+AgpKLa0+AfPpsyOvF3BSnW71gbuok2fSX1GANHE x+JZXjrwYGxg0a84gNutA7Qqn5A== X-Received: by 2002:a05:600c:5307:b0:480:4a4f:c36f with SMTP id 5b1f17b1804b1-4832096671dmr160891245e9.21.1770629107336; Mon, 09 Feb 2026 01:25:07 -0800 (PST) X-Received: by 2002:a05:600c:5307:b0:480:4a4f:c36f with SMTP id 5b1f17b1804b1-4832096671dmr160890915e9.21.1770629106883; Mon, 09 Feb 2026 01:25:06 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d33f5fsm316310295e9.5.2026.02.09.01.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 01:25:06 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 4/4] tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu Date: Mon, 9 Feb 2026 11:24:36 +0200 Message-ID: <20260209092436.2899888-5-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260209092436.2899888-1-costa.shul@redhat.com> References: <20260209092436.2899888-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nr_cpus does not change at runtime, so passing it through the macro argument is unnecessary. Remove the argument and use the global nr_cpus instead. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/common.h | 2 +- tools/tracing/rtla/src/osnoise_hist.c | 15 +++++++-------- tools/tracing/rtla/src/osnoise_top.c | 2 +- tools/tracing/rtla/src/timerlat.c | 4 ++-- tools/tracing/rtla/src/timerlat_hist.c | 16 ++++++++-------- tools/tracing/rtla/src/timerlat_top.c | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/commo= n.h index 32f9c1351209..28d258d6d178 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -109,7 +109,7 @@ struct common_params { =20 extern int nr_cpus; =20 -#define for_each_monitored_cpu(cpu, nr_cpus, common) \ +#define for_each_monitored_cpu(cpu, common) \ for (cpu =3D 0; cpu < nr_cpus; cpu++) \ if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus)) =20 diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 90291504a1aa..e8f07108d39a 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -244,7 +244,7 @@ static void osnoise_hist_header(struct osnoise_tool *to= ol) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -273,8 +273,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { - + for_each_monitored_cpu(cpu, ¶ms->common) { if (!data->hist[cpu].count) continue; =20 @@ -285,7 +284,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -298,7 +297,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -314,7 +313,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -349,7 +348,7 @@ osnoise_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -385,7 +384,7 @@ osnoise_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 6fb3e72d74f2..ab5db35f21ae 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -236,7 +236,7 @@ osnoise_print_stats(struct osnoise_tool *top) =20 osnoise_top_header(top); =20 - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(i, ¶ms->common) { osnoise_top_print(top, i); } =20 diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 69856f677fce..ec14abd45fff 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -115,7 +115,7 @@ int timerlat_enable(struct osnoise_tool *tool) return -1; } =20 - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(i, ¶ms->common) { if (save_cpu_idle_disable_state(i) < 0) { err_msg("Could not save cpu idle state.\n"); return -1; @@ -218,7 +218,7 @@ void timerlat_free(struct osnoise_tool *tool) if (dma_latency_fd >=3D 0) close(dma_latency_fd); if (params->deepest_idle_state >=3D -1) { - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(i, ¶ms->common) { restore_cpu_idle_disable_state(i); } } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 4bf1489cad23..db66312ec966 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -298,7 +298,7 @@ static void timerlat_hist_header(struct osnoise_tool *t= ool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -350,7 +350,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -372,7 +372,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -400,7 +400,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -428,7 +428,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -473,7 +473,7 @@ timerlat_print_stats_all(struct timerlat_params *params, sum.min_thread =3D ~0; sum.min_user =3D ~0; =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -620,7 +620,7 @@ timerlat_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -658,7 +658,7 @@ timerlat_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for_each_monitored_cpu(cpu, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(cpu, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 4eb820fe1f21..ed3d3d1c8956 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -446,7 +446,7 @@ timerlat_print_stats(struct osnoise_tool *top) =20 timerlat_top_header(params, top); =20 - for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { + for_each_monitored_cpu(i, ¶ms->common) { timerlat_top_print(top, i); timerlat_top_update_sum(top, i, &summary); } --=20 2.52.0