From nobody Thu Apr 2 20:25:28 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 66CD534A79E for ; Fri, 13 Feb 2026 11:53:02 +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=1770983585; cv=none; b=AO189HVhRFI/h/Zytx2aJUozfiF/mUVemNAlwjs0PSpTzjlotPJ1OMtVFdwafPMpoVTT77vz+L0EftGuwMukKWHSqjPDHf5YYsUTjEY8uYBvW0q5lY8BG6iequqEL6AuWC4naLokqGSOikMgatT3rDJBZrtr8RoASFIiBRNy5N8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770983585; c=relaxed/simple; bh=TS3My54+1+wB3igxyJXqNn57tpPk9g2oanX93lMf9nc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VqZfviE9ZxZqFPI7IKP6dNZWvfsNl+OvH/IJNZ/PoT4naHyVISMfcr1Gh430To2VzbhZ26BpCguxq6PoYLG3DYaJ26/7+51X0SeMPLiu39a7ro9KGMPAIenc54t4N1odycZCiebZ56SjZ2TZ1pl8CnFc2RnRNVFbgQC4ZuD+5Kk= 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=ft8vc/tI; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=PykWwsGl; 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="ft8vc/tI"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="PykWwsGl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770983581; 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=ft8vc/tIPootfPNPKmMq22WjSr/+YODBwMK6ijHdB41uIlxAhhhFUBSnzHNlVW/NbACQUm RxwYBdSntmj+wOFpl15nGWe5hvDQ/ywJ19DtIZSE2YkuBaq+1UX387BZirrzrk3FST6cg8 MPBKko6KwSzVK84D2LxqgHACp0eYBug= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-RTr9nVHvMBG6egctxjSthg-1; Fri, 13 Feb 2026 06:53:00 -0500 X-MC-Unique: RTr9nVHvMBG6egctxjSthg-1 X-Mimecast-MFC-AGG-ID: RTr9nVHvMBG6egctxjSthg_1770983579 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-483786a09b1so4951845e9.3 for ; Fri, 13 Feb 2026 03:53:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770983579; x=1771588379; 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=PykWwsGl6bIFj36Ca1IFbMkjdGT+uQ40usBmhbwtNgubp6KS1gXsNLXf+mLkztjcj6 nBaTegHKzBFJBcyAvtiGhYlBOQizd+OZ3MByZ+DbJ1YVHtpCjAPabHxF60+1ZYaSEJlI WNJQxFwdPqy92snFpVn6IeUOcKj0wtcA1YwwA9yhDRBNKgSO3xo/Cn8TJRXuk/lh7jyv IFYJ0K23DFXwODjpejNucmb997K2Ltj15dW0AUAPS7EfEkDiFlpFkq36RMuh/8vDzFao pN/q4yxYarVbjMfuT1iDfGsrBNafDCtZko7swbRg+F5YbPxWRe4ULug60aihD9udx6lb JCqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770983579; x=1771588379; 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=Sjzx/MBhI48ATbAyTwdTahkvVV+y8CD6H08bkJMBYvkKFDjQ6uUDknaWJy6i8kgptI iilsuAq3jdrMPlgIO8HT+345opcAoYZhabm7b1+wGbNT991vXXu72MbWBo6zeQaObyiE IlVTLGxU2XIZGwVqfpWn2GpnJj1JUSNb6aQup/AMWil96qfE/M3WkOXrMKeWM910TDD/ /2i9kDvogOPeKxZ3n1Iw2pKsc9Vy6CcWiw6bMj9DlKRKeGSAtctwrLGp+W1HoMGmaKEb Vl35axqfPIa4uwjQrLW7IkXNH0BlxwNMQaWF8AX8ZhYKPu/9LMjMnnkdwMEAXJ1s8PnR D4NA== X-Forwarded-Encrypted: i=1; AJvYcCUbMSWj2/byhnBxVPAFxE/6+DJTDKnBOOoJlpJ/9wxUSjWTucNNMywho73XXGi20yKLhCGT733+hAtMxtg=@vger.kernel.org X-Gm-Message-State: AOJu0YyJKuNF2RI6RjOSUECwZgSGNFowjKXZfI+YRhcOSJSQHzAiBhtU rJdd88moCOYNgGmlCY7Ltt3//1785CZDVkpiTxi8ig64ThqC2WKgAYZM1yFpXDYdtLm1IYCRjRd aYX1beULva/BxEjlB3PWVQTD20zPNzZPbkmH1QmstFEtYYKymAVcy+7FJ4Hv6XRxpoA== X-Gm-Gg: AZuq6aKfzxK3mxPTv2tYqmsOli6ek3EjJblEr3Rad+fgqFNXLA54x0nTAYO4owlWbAL 2lR8e9pKw8MYpn4Bi31Hh6x+Z3cA8jTFrLCMglP/586m9lz9OKjCdW0GdFBlSnagmCoKM1YJzWz YpfUv9Kvo22l5Lr2lgYgEGCNNEEeo3MBfEyajNJxmIxRgE8b7QTcmvcZKCu0jnFHU7o8ytZZ8lR Tr6qFoMTV79/lGoxbk249u9wUWnDa9ccqE2xkLwTer14RQ3+I3helfz2PyrI14G1FubaOfvZ10c Qkwh96Mp4xnsbVgbx6nTGoFs08vQ5qO/X0osBN+lkZM7W8UofexCxX/l4YcAlItHJA6M/hLvYvy XyIrVNmH6cWVojJsDBrqwiHD7C26i50IXtwM= X-Received: by 2002:a05:600c:5020:b0:46e:761b:e7ff with SMTP id 5b1f17b1804b1-48373a71d7fmr24271655e9.28.1770983579007; Fri, 13 Feb 2026 03:52:59 -0800 (PST) X-Received: by 2002:a05:600c:5020:b0:46e:761b:e7ff with SMTP id 5b1f17b1804b1-48373a71d7fmr24271255e9.28.1770983578460; Fri, 13 Feb 2026 03:52:58 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d835f6bsm234671275e9.14.2026.02.13.03.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 03:52:58 -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 v3 1/5] tools/rtla: Consolidate nr_cpus usage across all tools Date: Fri, 13 Feb 2026 13:52:30 +0200 Message-ID: <20260213115234.430232-2-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260213115234.430232-1-costa.shul@redhat.com> References: <20260213115234.430232-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 Reviewed-by: Wander Lairson Costa --- 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 Thu Apr 2 20:25:28 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 3956D35295E for ; Fri, 13 Feb 2026 11:53:05 +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=1770983587; cv=none; b=GtR8mDkTg1YoD+sqxZVtywTtVxsXnePKeQWD6oOEMcdPjjl/3i4Omx5pExPWWJFkfOCkfeLAHlyUp1K/pnJtzLBssc3OteHqFA4W2FGgvkw2FGVC6umq7JN81coAGospQqv3GvFz78zl8Xg7eGCHcxDLeRuk6StmzWulnV25/9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770983587; c=relaxed/simple; bh=0GS+sGsKXEzx+jNnjrXhGcR2pmtCanW/2A8zyqvNC+o=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V0PJmWNPpfseTjHUMSDMDgN9wL1Pb271mMg67ySkmblyf7yJzYpEwZyqzJJu+xb6CYmb/0SdUtzan1+3M9rIqzro2JHgx3wb+ooiDIeiJWqJEkm4goRVRQ/zg/dR/1SzvJnylXXEpxp3NcQlVuCZukX2zF9IuVDac8j80LKUf8M= 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=QDCqIWDj; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tlYxrYjH; 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="QDCqIWDj"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tlYxrYjH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770983584; 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=QDCqIWDj71v67h0ChLfkjzcaQxTvEyvFLI/StUXR6AqklaZQUkSdQ1HFKQCPXZ4UDe9PA9 Fi5SXBH8jvykT6ocat/yY/tLbReYmkS4DwXuPXJHCLSht9yghE8Mue4deZp1OjYjUmMqKn KrR/B6PFn3VIy/i7ByZNGIO+RzNse5E= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-444-byKf15LYM8-Aege2guEweA-1; Fri, 13 Feb 2026 06:53:03 -0500 X-MC-Unique: byKf15LYM8-Aege2guEweA-1 X-Mimecast-MFC-AGG-ID: byKf15LYM8-Aege2guEweA_1770983582 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4836ff58111so11023745e9.1 for ; Fri, 13 Feb 2026 03:53:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770983582; x=1771588382; 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=tlYxrYjHr5q8A0AEDpEMux++HskmFsHbZp8o1FpsWpuzP+jKolM5Z0zrhd7/0GMcFI 9u1ZSFjNuD1R2veLR2MfVFsivHc03nkLcE0RUBrRh7BPU3PN+AbxBKAPKnltOSVYHkB3 hoNZWHydlVWFHnlZRB105xe1GA8KAQowXGHD2w4WpmCQRKd3fUYos2pR8Wt7U8Uxgitz 4UEWPmnzxYC1/ikNjxwXoOX1WY7tffdczkr4hyD4PEwkyScMEd+vipXmlhoNdFy/Nax5 tdOOhkEDXvMelQxjDTG7B7Q+NjgTXRl7+WILbVokI33bZdX07zagNzpWrDKd7DOxuDFo d3xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770983582; x=1771588382; 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=wF2u15XklNH944faAiXdL8oJrtxmHXsJ2n6U4PTQ/tGWjtGMM2iV1wDRaZmnCn6cfR ceQMD+HBSX9LtYYpzoxo0/J0x0mDrOvfZjN+wJTBRE/CPqz7teo2m0SCqOSnfoXHbOV2 PjcrKQ2keTzRAP7h/C3pzUw3XnxV88tsn0y36L8JRSIE6r9clGcZO1BmKO8+D710udle pTVFXzLnRx7EwlSEN4Rip/P6CU+09sKA6VLcOicrOZqpRpz5VnJABVCqOQowdrB5/GTR PIKTThaS06Kj47EBkRbNpBXum4A2+WJHqiEbQq3gtkW97SMRPaLFtxWQ0WfdZVyi1sgF SNhQ== X-Forwarded-Encrypted: i=1; AJvYcCV/1LsubNwcGv/JUYLyBNv/pG/a3yfaarXKMYlVn66E+hhadDwb7Wny7rcCmQ+tvkQ1qBoDArtFdYRiG/E=@vger.kernel.org X-Gm-Message-State: AOJu0YwxLpiebFwUogmJgmXnUJ6pR7E/5HQP/eX52cK3FXj8wF8bAg2l vwctsqmDpetzwJByVkcTQMP8q5tO9Q/cVlvJPJ7cz+Pn4FVWM+3Tf7CRwlbJ/WsrVCTwNYs6fjz KjL6eK7LlcqrYcynIixLYCoztu2wZGrwR7sAGqXtfRrS4q7kR3YMvfRgvLZYFKq4fOg== X-Gm-Gg: AZuq6aL0Xkr83lTAhanXiUioeAibSqYjS7I75/XJITnpIaDuWQ12Tsf4U30swJHQSZV GZIyBLiXxWBVukkBa16AUEEpTg6yGHZjpKHU+MLOv1nbjlKE/0QTlbfSfYb5z9T3mfbZ90suUxk E8psO8a7MHFYpjXGM/sNlgho3ITQDmhyCn+0ANmfFH276BG9kl0mefp+sK1uP4assZPZWEl2mni DxxG89tAp8BfRq504hUGtAsjICQKzOEOaXzV4TO/PJRyJgsOkGXxc+ljQdJu2D0ODVYgvko3tgS OPOn8M8PCcKAoGtRBbFeRNMbNui9RlsWiQ6sQDnKnuDzxq5/ZapT9jtk4qvQJYuoghry6xBgb/v 4UGOTFSqB3n73cut9T5Co9cRXCVMMx3jLGOo= X-Received: by 2002:a05:600c:5296:b0:482:eec4:74c with SMTP id 5b1f17b1804b1-48373a5d771mr22090245e9.22.1770983581821; Fri, 13 Feb 2026 03:53:01 -0800 (PST) X-Received: by 2002:a05:600c:5296:b0:482:eec4:74c with SMTP id 5b1f17b1804b1-48373a5d771mr22089795e9.22.1770983581338; Fri, 13 Feb 2026 03:53:01 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d835f6bsm234671275e9.14.2026.02.13.03.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 03:53: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 v3 2/5] tools/rtla: Remove unneeded nr_cpus arguments Date: Fri, 13 Feb 2026 13:52:31 +0200 Message-ID: <20260213115234.430232-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260213115234.430232-1-costa.shul@redhat.com> References: <20260213115234.430232-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 Reviewed-by: Wander Lairson Costa --- 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 Thu Apr 2 20:25:28 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 B8B0535C18A for ; Fri, 13 Feb 2026 11:53:11 +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=1770983593; cv=none; b=Hm6aGSYcxsPEncXHu9qE+2jj6HpuRvttQ8TKatiMSPtmIznKDXM03buI8bQe/75XDdpbQ37FROnrHJe8p3WgAoHn+P/Ydgfd5eZHoEWRBPSZR9a9OFNyWM9fEuTlF1WLW63HgFJpIGn0Zgb2wtzfln+r+rxphjFNt/a3Fek60Ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770983593; c=relaxed/simple; bh=w5dKFS5R1t7rYrQ20YIX0+7bdom2BHUqpe/9dlSUrLY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uN+aRvtHI9A9tMnb0hYk9zjap9dwTBYjHFpknPOCkBrrdmNWhNyfxHBZ4zQBGliv8p68KwVlRz2I4/53+j1v5AQ7ChLwMnJYEwnP+Ayn4XiR7H/ikbWaOOne4ZRxnaK7LK3tet9T5kde6l42MRY3ZnqdzVzzWQ4D+d8TGaZXafA= 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=Ipw15F7U; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=rx0vyNPK; 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="Ipw15F7U"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="rx0vyNPK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770983590; 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=Ipw15F7UW81mQZyrxruiMsICv3ncEwmDiqv6g/IHSgqoBdMgfn8BpO8wNBwHtL2J7ThrFl x9jHe3MqbNwTBrWNiXlD/oeB60J9eIp7/SwwtUJM6TBCnjH/xbH2qDkgxxEBMPZTx2IiFG W3OBBZ+e5LC1ti57P8cE593Knsp1PoY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-Wiw61cC2MNeVyub6yeBghA-1; Fri, 13 Feb 2026 06:53:07 -0500 X-MC-Unique: Wiw61cC2MNeVyub6yeBghA-1 X-Mimecast-MFC-AGG-ID: Wiw61cC2MNeVyub6yeBghA_1770983586 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4806865a01bso6036065e9.0 for ; Fri, 13 Feb 2026 03:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770983586; x=1771588386; 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=rx0vyNPKiTJZSgvwL8LNCF4TNzLgereHFpho/tKLu8DD44JHIvdMCuYFRHF6jr+xHh wJT/UUbgcMWhSR+9nIQL9v7GOC2dzn2nmO0VlYrjhNSynoIqviJyPgv86q/iJvmTIQPO 9TEm1NbXXLNUFltdnnr42Ym9Vja4bXkb8bSKbojHAHR+pEHU9oo/jx72LOdRL6mikkJg ngC5jBv+skb8XJnPpsf+xR8UJQ9m58ia3nD1oOtp53ehWlPcyYwTht0I+HqA3Zyc8nrF YLCZMWNTyT5xE3WWOs5d9t4CGlWFdd68tyj9bj+S5DqO5nZ0vlPvmKVyn5PbCU7r0qF9 yM6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770983586; x=1771588386; 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=cpW3N6X/Y9KnNR44fuxJ/B/6+BUR5kutIHq0To82Fcy2D0Ff7fxW0iEdQ84qhyrvhm PPHRW85i/XW9SobXlbJWHtZrMVX6SQQQyhlTGxiK4N1j6wlX3KGFpbboUHJ7Kc+Cduvq QewzMm4ehvQ28nI/rGCuQDaVIcy0OM7BRnWGB064sKZAwqSezbb0OyBrw5LxBY44uvo4 Ed9o3LLj2hThryFWTPbVy7G6wjQhtlmDBDZ1PDanV0d4BQ8ok0w8o+82lG92Ohubybo4 vUICj61D1hA0o106oOF/qHm/nWJLimm2wSrHarjGuWn3L7ZeumGV+8dCNXR3ZMtdcvo0 CUFA== X-Forwarded-Encrypted: i=1; AJvYcCWYjS6Ci99uHmSS8yNhiotRi8704/Di03LwnF9IzYW22TiJIKOaEJEoDrXN7JaEqBtqSlmuxx0V7rErngg=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+98SK4UF/aLKZbcUCo1qpz9/Dja2u6iZzwcRZziRTSBRuC9No Uv1WtF0qsNrTDMjV7WNIWlKObkGcVuR9fsYHU9MEb3gC85Jgxlvnies85uff/D3YClpCwFD070F ZFMiiYQ/Da2mN+oZKCussfUrOzK9borXPOnbEhHwh7/S691d95mybEkf1VynRX9yVtQ== X-Gm-Gg: AZuq6aI9B7Ytze/xtcB+Ov1O2hXOEiB64RJVr3r9fYwd6LvUUY+zlHewKQpwLaolwV8 qSJkZSMjKzvTZxpFqVhBffb9qtE+iZuv9Bzs/LmQti6vlJEWCGJT7SWzYNyr4llL55mXk1KYUGN lnT3OJ84G4jdss4Mvrxjyv8HX3bt5N8Aats8UaIPyunBaGQ27o9KEJhLQFuzypZ1zEQHhdoAg9t 2eWtHyq9bULB7BtPZtLgILUBlGmEXfWj11TMFyewRyXLjZqU5IMqaFMmkHSoBIhQknP8sUuiK7n g/cdANJS8HyL5z9GrsDwf4mZw9K7d0BwlPEZkf4lliPFCcN6poVRkNVRctbLxb6Ut8SnFIzhv3Q Ib0NbSMjt1SgK0zc1rT35rpeYqwYtGtbOMHI= X-Received: by 2002:a05:600c:8706:b0:477:73e9:dbe7 with SMTP id 5b1f17b1804b1-48373a58a97mr22578695e9.35.1770983585910; Fri, 13 Feb 2026 03:53:05 -0800 (PST) X-Received: by 2002:a05:600c:8706:b0:477:73e9:dbe7 with SMTP id 5b1f17b1804b1-48373a58a97mr22578295e9.35.1770983585422; Fri, 13 Feb 2026 03:53:05 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d835f6bsm234671275e9.14.2026.02.13.03.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 03:53:05 -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 v3 3/5] tools/rtla: Remove unneeded nr_cpus members Date: Fri, 13 Feb 2026 13:52:32 +0200 Message-ID: <20260213115234.430232-4-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260213115234.430232-1-costa.shul@redhat.com> References: <20260213115234.430232-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 Reviewed-by: Wander Lairson Costa --- 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 Thu Apr 2 20:25:28 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 E027835CB87 for ; Fri, 13 Feb 2026 11:53: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=1770983593; cv=none; b=O3FB4Nk9YhyP7/fHq48rU0YhdQk6oMJwgmjF2QqlEti8jGQU7kwtl3/CX8ZHPuGG8yfcF6+nak+Dnob4IR7QVvEFhHvYTwk05PiAQy8Qk6GQdDUTPaEDXEFQoZgKeY2gviNWj+6BUbO31CDi5kycUDZhJVN7M01u1LQ04MpFikk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770983593; c=relaxed/simple; bh=jXM6h73fi/T1NI6sc5NlsOcr2JeACiIlmwKPddXhEyc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NRGU9IPnhHuYIS2eqBvFKTxKDJr1Mkl/zkwky6foAaFBUrbTgG+bUXS4vHsZ05vWiAQGsxJ4+U2s+VVvCCMImAsvtZKks3qvdwKcse5ily6Kt8i4aPN2kdj8qxEZTcD7c7lIEXdugN/VfKeo9x9E2VMnBwP/TsGdOG4bcZPSULw= 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=fHQ4yFmf; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tGvSbYfA; 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="fHQ4yFmf"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tGvSbYfA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770983591; 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=fHQ4yFmfP9+oeRicat5VTr7LiQOH8g3shd6jSAz14YcMolzfJ80aZ93PFpMR/Dj4tiM5lO cMrzDMFdHsc0jfy/jGPktNEMBfJo/5lo2jevAVCNCZ+gEbQZWtL9ZtGku5vVWcE+ePYUJ1 6cECKNf6BayJBJPP4CyKe9ak7b5X7UY= 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-149-y_WwLVc3O9Klr2MNB66C2g-1; Fri, 13 Feb 2026 06:53:10 -0500 X-MC-Unique: y_WwLVc3O9Klr2MNB66C2g-1 X-Mimecast-MFC-AGG-ID: y_WwLVc3O9Klr2MNB66C2g_1770983589 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48069a43217so7784665e9.1 for ; Fri, 13 Feb 2026 03:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770983589; x=1771588389; 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=tGvSbYfAi9k7YsSjsCciLtYL4ES8bVDTe4FzaTC+K64cTN3UutclUKkxVol0AT1ih+ 3iWFKiU1ThXiAvVu5dZ2Qt4nr/sADVvKzVeX5NxbrANQLeZKVmNnHw0tUCRlgQQXrUTT PYM2CfieZ1dBMmeiZTaTpAV3xw/1Yx7C5mRKZe0b+Y5UZ5eO8jFKNDwb9WBPzGIs7ajC KQE+eoEEnsyCBke6iWbCFVD7msA/PagMXTV+DDfuNJGrF3UksSCckzVGV/y7YaLTOwkd 3aD/RvVBZwvvj2jt3JsQHcLW1Fbdf9QZlJsXnhF0QmVxNR60j80DFN07DFEt1m+TaEy8 phCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770983589; x=1771588389; 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=EUqQsu/X8TJWRLlBlEgp1H1+UQtjocJZ8cQnd+DZ8LBBLSRid8q7EBEfhdL7n1BcQ8 Ckmgenes4FAAdSaFnHRJVrLqEzRzXPs5TR5weNGHpeExqslkns/TniTFFeDvEQ4KvN9D 8FNRMTQOY+HmXLgY2pIUTTK2QO1GzdTsbMKICZcb1K07K/PZgDCZBzAt4T/CdHkocVHg uzW9jlPOp8cTQHPx9IX56ufB2WD1m3rtHfEtUkFPYs6WP6+DddeQ9R2STa2XMjQ1BH/g hIJz7E4TopGbt5+2RiEn7rio5jW5eQCZdchD/xBh+w7BIrsOG4zwxZdV4V3WEH8naw9o AGnw== X-Forwarded-Encrypted: i=1; AJvYcCVh3fdBp8MlNX2kptUwqF9TdaYZ53UekSfRZfNrIbOsnb+25wAMgHid2obkw7BLJ8amcPhxnO4AnyyDWQc=@vger.kernel.org X-Gm-Message-State: AOJu0YxYUh9lfGRRmFk0aK6P79c7y9Wm7aIhgFySK6lTClLUlNeuQM6h PC+y6zOujgDpK+PnD7ATrbVDI6Q2kOU2dbVa5h4ofZ23XziktKBvXwMABXAcPWAWdrltpUZDasO s1MYvsmTAgAyb9xYPtru6ASXOQQW9hxQq3CQwPT1IvAlG+rkkNKJAon6akeoK94lhKQ== X-Gm-Gg: AZuq6aJDKMC8gyIuNQCFTp/QsnWiwEVpIZr1SDNGHOqo8cJ1Pui+ykLUJIQRh4fAM2n pzGY37y623sIGFeszMcSiYScRqf9lY+JVGLISJvj7gXhvqrMHn3BQoBq49TmXz2IOIrV1Iv2XsN fBXpxP5J2kubYzLFs1RMu0tAoyYwEhXN82M9Ytks9z+A2ITn64gAhnLxxNyfHPJHEgO9d/kwy6f 4V8lo67XEZX5CNoC9rgmHZzvOs6s3QnJ7MP1wy90CKEoTYFdtGdJmhCmsSvGrSRManEtRglTwVq eR0+2j+pyEgyP5wn+LFI8jURbFKnvImO3x6KjLAv+cUDhEt5X81AyFhaALd/5f87FOPtr4jacW6 1nUBkS2CyEkd1WpbSFeiohH5rHCULG8EiqOE= X-Received: by 2002:a05:600c:45cc:b0:47a:814c:eea1 with SMTP id 5b1f17b1804b1-48373a6c1f8mr21763945e9.35.1770983588509; Fri, 13 Feb 2026 03:53:08 -0800 (PST) X-Received: by 2002:a05:600c:45cc:b0:47a:814c:eea1 with SMTP id 5b1f17b1804b1-48373a6c1f8mr21763435e9.35.1770983588037; Fri, 13 Feb 2026 03:53:08 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d835f6bsm234671275e9.14.2026.02.13.03.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 03:53:07 -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 v3 4/5] tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu Date: Fri, 13 Feb 2026 13:52:33 +0200 Message-ID: <20260213115234.430232-5-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260213115234.430232-1-costa.shul@redhat.com> References: <20260213115234.430232-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 Reviewed-by: Wander Lairson Costa --- 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 From nobody Thu Apr 2 20:25:28 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 DCBDD31986F for ; Fri, 13 Feb 2026 11:53:15 +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=1770983597; cv=none; b=qy04FAUOJ4Qqc7idfSOvJJ4YVpFgGfcJ4CYKXdK/UViVg7Sf/8vpBvvrT2qYT4PxLNLSknwU28C2nYDyOQEu8uf+xQ243fAPyKOwsOLT9dLXX1r9sJBpVuRcssRyRUCtaTIaaHOsuBsdAJ2M7u51FtRrfhqbVJHX9n1vNtvw/7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770983597; c=relaxed/simple; bh=2ZVTZcJEQvp9j4d2P5a9LlD36iiY34YfpFu/m0+lLq4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScI71bY/tZ5DLZxXf/uaTPozie3mtRVUs5a3yc6T1d3gb2+nKcD9I1vKTes68vorVq5XAvU0Gc1Fr/AbFXSBwVv1JIDtcY+bcxKNflgqkdVE1ME/J8M5QN8MIsIRiwk9AmFUneNsrEObEnShxKTeNG+2WkNF0KR+deSR4ykmdJA= 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=CcWWn4/A; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=oxCjBsb+; 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="CcWWn4/A"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="oxCjBsb+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770983595; 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=WBIaDmc/b8KhOmbhsBz+ARqnHRu5Sb2xsdw5j1dfy9I=; b=CcWWn4/AKEy+rkBre1DCGdu8aDg0lYKWi6N775ArGMMrauvYHnJEpwe9+Z3G+/+dhgpoUp i3Y/knv1QvagOwATivBNC/idzF9Iysk++WGC10w7zRg1VUz6TlXX49a5ikPKL752Dd+vKy bBWHqMoGSnIG9DkZKpRFR/YUFb7xoh4= 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-201-xP94rPyAOdaACrcB7hR25Q-1; Fri, 13 Feb 2026 06:53:14 -0500 X-MC-Unique: xP94rPyAOdaACrcB7hR25Q-1 X-Mimecast-MFC-AGG-ID: xP94rPyAOdaACrcB7hR25Q_1770983593 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-47edf8ba319so10956195e9.2 for ; Fri, 13 Feb 2026 03:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770983592; x=1771588392; 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=WBIaDmc/b8KhOmbhsBz+ARqnHRu5Sb2xsdw5j1dfy9I=; b=oxCjBsb+OtyvINW/HQaSx7kxMNeCW6P7OF20/KoSpRiqIrXBQaOl/vBSmSDpv7/321 UJSlgrrpUymLiqTEGIxBYYnAGuzYulM3ogkeB26Vpz8pS5NuETeXxA56Wo6JLH/OlQ7f 1PP24yMU9hoEI5QPQ+aWxw1aZeFzLbG+CH0hHjdZxIY2hggXeFl4ZY6pkPiTY/fgmVqM HTXYi804hdbktzwQE0RdqgfStV7EolMJRNrZ9E7An+M1y6d8WA/97/MyEvSkPgRnoLgF YCK8HHTDC5cKdyuVxCBvMUqKZKi3Q6XBdWf0th3Ojgihr7RKzotFouo+xpRdGpGgdUoY TVeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770983592; x=1771588392; 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=WBIaDmc/b8KhOmbhsBz+ARqnHRu5Sb2xsdw5j1dfy9I=; b=hYkPhpVb6iIbIHyDaygYcJHphVmECeMJEUMR0R1DZBP/wX2qkJBJz/bWMih4YmXSYy Ok3YRA3/zoxDeEsFRc+TWPl2ZfSVrIprR3x+rcS0rLYhUk8edOsXSkwGi1kgzd0t5fgs xOKncZ/SwNN9e+ToTQVpRsxEzKuQphuVFOoze3FUD1C3QwnMifYuEcAHBCVf9DGnB2xC LBzR0Z6oncgzc2azTJ40IlW2OXpn/9iQBie/DjoLiT7PGnkUXN7nkmDlTy9xSgrI/AhL gLmJ9xs1E+mcqyxVNfYNsufKp7hWwfEIHJL/DHpkMzEUlR80WydY+dFbH6Q3+1cZkflk QR3A== X-Forwarded-Encrypted: i=1; AJvYcCXcxgvFAeX0eFLX2s+6tnR12MusKstJpMnpB74RlO34SOWu71JnVnfhXuARfEg0BP76S8pw86AFRvOx+lI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9+OVq22bPoA5T4FBI4OqtLQtsWyMceflOLm4oX/MbLuA7g/eM P/BilJTo4B9nmCt/DZIoc3MJ2se0z/E+t+eygqunelnqMfaz8e62FcBrDaaxcmoObJQU3ELa64i bEjPbEdNbcv9Y/rSBcvctM5SXvxhJaSIlcd7a5cw9RFZmMYRtL83JjQnm+CrQbZoCyg== X-Gm-Gg: AZuq6aJ2A1UM5HvTaUXhxwtsRslCsVDNXeN274Y9PFmx7n91dXQOrnmF1Xy3U9Irbmk /JqsFcLRrE9nLVSTfpcV71C1tfdMqJiCzqYPwwXwPVhxNnj52nBajPSWhp552xrN3XyOez9ao3m L2GU55P3IVAI6cylcbIMf/c2rO7atRBm1D7nKWvy7Ab11XE3uXl/ZvY8pleqK/8QA5aSnkhqPEy 2+g1azAOQ75owQi+hj9c3jMR9ieOR0MDY1/GBiiKE+eR5EEq+oI8gIrbVPTozIsW8pDhndyrI4H 4WoG4q5PA3oYv2g9+L2kTKNFI8sY4jN3HNAtJbz9rwFh5MSgcVEOtPavgJRQEWXKgPqwD39NRZp UmKEPtwMQfgsc6xZj6n7B28NHHaHF4fROLNQ= X-Received: by 2002:a05:600c:1d89:b0:480:3bba:1ca9 with SMTP id 5b1f17b1804b1-48373a083c8mr27813015e9.4.1770983591686; Fri, 13 Feb 2026 03:53:11 -0800 (PST) X-Received: by 2002:a05:600c:1d89:b0:480:3bba:1ca9 with SMTP id 5b1f17b1804b1-48373a083c8mr27812615e9.4.1770983591263; Fri, 13 Feb 2026 03:53:11 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d835f6bsm234671275e9.14.2026.02.13.03.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 03:53:10 -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 v3 5/5] tools/rtla: Remove unneeded cpus parameter from timerlat BPF functions Date: Fri, 13 Feb 2026 13:52:34 +0200 Message-ID: <20260213115234.430232-6-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260213115234.430232-1-costa.shul@redhat.com> References: <20260213115234.430232-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 is a global variable available throughout the codebase, so passing it as a function parameter is unnecessary. Remove the cpus parameter from timerlat_bpf_get_hist_value() and get_value(), using the global nr_cpus directly. Signed-off-by: Costa Shulyupin Reviewed-by: Wander Lairson Costa --- tools/tracing/rtla/src/timerlat_bpf.c | 16 +++++++--------- tools/tracing/rtla/src/timerlat_bpf.h | 6 ++---- tools/tracing/rtla/src/timerlat_hist.c | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src= /timerlat_bpf.c index 8d5c3a095e41..dd3cf71d74e5 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -147,24 +147,23 @@ static int get_value(struct bpf_map *map_irq, int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { int err; =20 err =3D bpf_map__lookup_elem(map_irq, &key, sizeof(unsigned int), value_irq, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; err =3D bpf_map__lookup_elem(map_thread, &key, sizeof(unsigned int), value_thread, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; err =3D bpf_map__lookup_elem(map_user, &key, sizeof(unsigned int), value_user, - sizeof(long long) * cpus, 0); + sizeof(long long) * nr_cpus, 0); if (err) return err; return 0; @@ -176,13 +175,12 @@ static int get_value(struct bpf_map *map_irq, int timerlat_bpf_get_hist_value(int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus) + long long *value_user) { return get_value(bpf->maps.hist_irq, bpf->maps.hist_thread, bpf->maps.hist_user, - key, value_irq, value_thread, value_user, cpus); + key, value_irq, value_thread, value_user); } =20 /* @@ -196,7 +194,7 @@ int timerlat_bpf_get_summary_value(enum summary_field k= ey, return get_value(bpf->maps.summary_irq, bpf->maps.summary_thread, bpf->maps.summary_user, - key, value_irq, value_thread, value_user, nr_cpus); + key, value_irq, value_thread, value_user); } =20 /* diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index f4a5476f2abb..531c9ef16f51 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -23,8 +23,7 @@ int timerlat_bpf_restart_tracing(void); int timerlat_bpf_get_hist_value(int key, long long *value_irq, long long *value_thread, - long long *value_user, - int cpus); + long long *value_user); int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_irq, long long *value_thread, @@ -44,8 +43,7 @@ static inline int timerlat_bpf_restart_tracing(void) { re= turn -1; }; static inline int timerlat_bpf_get_hist_value(int 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 db66312ec966..1c4702948532 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -209,7 +209,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_t= ool *tool) /* Pull histogram */ for (i =3D 0; i < data->entries; i++) { err =3D timerlat_bpf_get_hist_value(i, value_irq, value_thread, - value_user, nr_cpus); + value_user); if (err) return err; for (j =3D 0; j < nr_cpus; j++) { --=20 2.52.0