From nobody Thu Apr 2 21:51:46 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 22A874301B3 for ; Fri, 6 Mar 2026 19:54:21 +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=1772826863; cv=none; b=etUie9ZeyW3Hc+FssTOcvyJ7AeaCjwtrj+Enua5J1VblS5+PnI6Lo0lXuqwMkdv230T81QLDTayHLryhoq3wBjLhme9k/W0fGjcY5bemM+AqQWfkQveNgbI6vLPwSuyrhl41OM3XGz6hg73axkMWUURQMp63SeN/UAg8DIMNzUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772826863; c=relaxed/simple; bh=eIx0WUCThzc1Mhd7tZA/tvw0jMl5/Z7DBQ1leSDTcY8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PtHSuWAHIXb8jaQc+mHbANLN9ESIClsAPI205j/T5giuwdRtqXCy413ZWd7hcfzUNT5H4MDYHL9B1SiG2LGgcZ65pjaASYrDW3Xh2yoEz1pNqfI7081I9uGPPvXQj43cSIbIsOCGiMohxdinfI0JWaxW+PAeARliF6JIl0/o/uQ= 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=UEzZ6xPc; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RbtelPOX; 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="UEzZ6xPc"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RbtelPOX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772826861; 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=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=UEzZ6xPcAZ4ua97YTf7x5bIzFhB3DkXNiGVH3qv94Z9ZUqreVpYIJaitafFH9Q0sKpZ9iH xxc6pEj+TcdFnfmi9HmC6OnlbXXDUMKlUxGSnJlEM3kmKw2ose+igkgrmmZCn3iE27ZsMS eWjXpODXQ3HnusY0SRc7I5aVpFBkU80= 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-481--Rq_yd6IONmGzTIJji_png-1; Fri, 06 Mar 2026 14:54:20 -0500 X-MC-Unique: -Rq_yd6IONmGzTIJji_png-1 X-Mimecast-MFC-AGG-ID: -Rq_yd6IONmGzTIJji_png_1772826859 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-48379489438so95919625e9.2 for ; Fri, 06 Mar 2026 11:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772826859; x=1773431659; 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=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=RbtelPOXNaIl5isfcx0WE/oYJUNLEyT4IwOwsnUf3lTsWMpmrv9rPZG7LAxw6GhiHy 3AT3GUM8rv58LP6xmx5tqj52uCrBs0z4WXGN4T4ter5OzA+LKenB4CzvjX1qZf0/dOtk JNxTUsMOGTxUcF/UP1sccdMQcZI+glsYZe5GFp6grQNapT3U8tKVg2G3RYejPxNS6k1u LtLt1j5FNDVK/ySXYKjPzIXZOhdkp81NIvCux52TMqv110xYK0Sod5hcRJHPnNHTEQUA Xq6x2IoY8c+tZK7x2iaBDXjTdL2FyKcDNL7bwcrBMjWdzR9l+rnSZ40tyTIqR10Zzy4U hXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772826859; x=1773431659; 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=4DvYpwDJsCCEBALyiCy6MGzM+CIB2BT5my2pAupEVpA=; b=MiDA8ZYkRnmcS8czhPabkVUQ79moGkHyHZcr0gbV4Z+HI6P9k1GH5uQVsUdXfSiS/g pfj2jXuEUd2V8a31Xb9EJ+5j8c00lPDm++5GrWG3iJgJvSMOooyOtRJzjOtBpp7i2GsT n6XoIDsZcz9FcaKLdAyHgC/QED0Dt0MBL1VezFPlL+he/ZnYQy0vrWxYVP1w+MOBYgjz XgRiMG88umUh/ERfh6q2ZQ2pl9A7Ek4/FuOnwGp8+SVDaaQ+vdGRm51uOl7BOivhSxth JxeJsi1mlxCbmxYJpISLkOfkj6HSBv4pq+0alV/ouoPISb1qG4R9qXodKvGW7JshwD4q 73AQ== X-Forwarded-Encrypted: i=1; AJvYcCVgLpsY6SrF4kFPJhahNUKmiDObinQYfGkeoGqIYCZholGHtdhGEog4oFTuRRwaZ0X1AXd8RsP5uLtTYMQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzFpeaCUzGLK0iNMYAypmF4gRzUFOGwfWSS+nSYpO4CHbwUyFsq LDqd0mkI+zU41985wsVLO+i02kkWXiI5GXCqoIh8Y/s+QkzMp1FGqrjuSm4kjR/CwgEEEVzOZPu 2B1GLCZkXh99sA5DuF2GRnY322krlmWtN8Btzlf0VIqP3mpBdn8i6X+vc/2J8yKG4Pw== X-Gm-Gg: ATEYQzxRNMoX4XmOONcpD2oSHoftc3MfcAcJRRITtH6GmzpfyKVrV0AMvvagDMOP7zx hxkPj9d6CSTQlOpLcJO/q5aC/cTM07gg2W/HnsH326g3TQagd7NfpJGcson7vTJ78iUH2PuyTAF iHD/5ZTTog+BlndioD+NH3H84kx8M81iIklPpgv3Mp8MjtpPX4Q7/vRnVGW7qyoxOTR0Rq2Ccwp hiQeUYCj4AGTuRTCsSlqpAnH3cjQ5b5fpjPb9b2p1GsxlRhfwBaC8WK6psPChYHVf1oUaP2XICc 4QehlKHpxxESQLXc5UX/KdW/L3aXr5JR5TjzINtMQ3A1JifJ5zjrRHA4Zl31EN6lhQ6qk/i95ZX rR5KUBdubDTh56rN+GPV/htulhcn4ah4acja4mQ== X-Received: by 2002:a05:600c:c088:b0:483:79a6:e7e1 with SMTP id 5b1f17b1804b1-48526919935mr51129795e9.7.1772826858732; Fri, 06 Mar 2026 11:54:18 -0800 (PST) X-Received: by 2002:a05:600c:c088:b0:483:79a6:e7e1 with SMTP id 5b1f17b1804b1-48526919935mr51129545e9.7.1772826858229; Fri, 06 Mar 2026 11:54:18 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e223:1b00:fe51:8bb:7986:c897]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b75eesm48596485e9.14.2026.03.06.11.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:54:17 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , John Kacur , Ivan Pravdin , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v4 2/4] tools/rtla: Remove unneeded nr_cpus arguments Date: Fri, 6 Mar 2026 21:49:50 +0200 Message-ID: <20260306194953.2511960-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260306194953.2511960-1-costa.shul@redhat.com> References: <20260306194953.2511960-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 | 19 ++++++++----------- tools/tracing/rtla/src/timerlat_bpf.h | 12 ++++-------- tools/tracing/rtla/src/timerlat_hist.c | 21 ++++++++------------- tools/tracing/rtla/src/timerlat_top.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_u.c | 6 +++--- 7 files changed, 34 insertions(+), 51 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 00b8c95cbf85..f39f60d3b00e 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; @@ -651,7 +651,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 9a6cd9a2470a..3a241b69f622 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 @@ -495,7 +495,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..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 /* @@ -191,13 +189,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); } =20 /* diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index 169abeaf4363..531c9ef16f51 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -23,13 +23,11 @@ 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, - 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 @@ -45,16 +43,14 @@ static inline int timerlat_bpf_restart_tracing(void) { = return -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; } 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 3ebe41eed9f6..7e735b62488c 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; @@ -211,7 +211,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, data->nr_cpus); + value_user); if (err) return err; for (j =3D 0; j < data->nr_cpus; j++) { @@ -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++) { @@ -1045,7 +1040,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 4105638f45c4..994e89a57cd3 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++) { @@ -791,7 +786,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.53.0