From mboxrd@z Thu Jan 1 00:00:00 1970 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 D8E7332470D for ; Fri, 5 Dec 2025 15:19:53 +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=1764947998; cv=none; b=UdyuWM0jU6pi9/fGNgyxQHCOxV7+GFZo5DJmMTdICFCGDtyDQSgUrbTSMaqWu/KY9fYEDgKYOx+XPCcW9rlIXCrMlB4BKZ7RCKhSMc1YmKFKUSQ3GUwkOh32JMx5AgERxBIm9wwZM/xmPzuGsCsGzReWrwXOfdPJpBKO0zhtsIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764947998; c=relaxed/simple; bh=fqkDclscetl1onzDkAYTGMs5/xfnJigxLB8w63vxu38=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kyr9NMqhzScjZe/XPNA4L2/oPL7q5olmIJdWBLjYofYWi2qoSxp/2oGFZ3n4kruPRXmOfm1hKacqsHd9OeRjvgcgCSbtsq0J8zGwYfxoTXmlK/z3Rbi83VyQUu/u5CFujGDUn4FG+QX+iAX6dC09+pCj2VKZyXcgA/y665uqXBo= 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=WyfexsIx; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ffRbShOR; 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="WyfexsIx"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ffRbShOR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764947991; 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=OoCD2KwltZzGeGT9ov3HcxpnEQgu1EpiOMCYmtKAx+k=; b=WyfexsIxYpgdm9FPJOBTWMCSORAi0XVel2fUAu6qbiTpUj7aukBflvXyd4wKUeP08gOND3 Q8uJf1fAde0dBzJLVwqcf6DFwr34vm0CjrrDFYPKdE1Kp5kizWlEVymZ/JDsWW/YlB355q IFN/GqdRMytK3ep6djzL1xhnj/Af0QY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-lgw2GAQBMeavBnAubthw8A-1; Fri, 05 Dec 2025 10:19:49 -0500 X-MC-Unique: lgw2GAQBMeavBnAubthw8A-1 X-Mimecast-MFC-AGG-ID: lgw2GAQBMeavBnAubthw8A_1764947988 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4775d110fabso23753365e9.1 for ; Fri, 05 Dec 2025 07:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764947988; x=1765552788; 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=OoCD2KwltZzGeGT9ov3HcxpnEQgu1EpiOMCYmtKAx+k=; b=ffRbShORwU07BlzVyuE+GjzsikNcWy9DAv3ZEVPyBsiW0gon52GDeJXDqKtEQwqdrQ sm27JUhDQf+SWQA0bf5Vydd7PNFoeutgBKZIEhVrgTMZ8xDK8fvIH+QREYp00biIQXx8 Dr5VJ9ai90yhzzY9b1cj16JgFJ7ekWCmF5WYpuxWdQTO5DdjRC4RkfJHDmn1LloPKNxB RhVpRDLWwBeGUZh73I6cf1H5y9LlmrbSRfqakUz6JC1snAXi76YMwg9Rkb9Zm5rtoCKM KSjQOj0DLS0LTbaTohqm0JD4EEaVtzI4ESSEPrjSoxYLncNuy7aII+sT+YYBMSh45QQJ w8FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764947988; x=1765552788; 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=OoCD2KwltZzGeGT9ov3HcxpnEQgu1EpiOMCYmtKAx+k=; b=uc7GVqTdKQoYMHph7j7y+zkeqzhdPo0y99iS9Zb8Kbvb0uBa1h+gUMO+anquy+rCLd +EwnQjBFYRtn+Igo7wcHI9lVu6cGbopXOP/yKqcsDiWcsqbo+AGy1bjT92FrEo3Lj4Rz shjXdFWtixkyAPU0RaxzT6ptO3fQZKOct/KdQu9eZLIZ7PzYrUpdg73fGSVJjDlGVEBQ 1ta9mYE7d/Pq28vWajbd51uoJ0gKnPIs7F7cIH/B9kM0OKRuP3tXsl2sXKfe0chhWFWH TmTCYSYjx/NjZByAwEKRrgSGCmGDPDOUPyC9OiH5vClqKeaJ9u0VBQXMUhdNxuVyi9hz m/qg== X-Forwarded-Encrypted: i=1; AJvYcCXw1orqH+QXUBOIb6V0v3jMd3K9WcleXmI4kqVA/s0NQEcsZ3H4ezc8WxSKAAMD12R2HbYeSlb8QpSSpZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YykETbQsJAmzZelJ1Txp+G2aHNi1rXDeTWMMwswjiXsoG5gDRpZ CKwXVp+dqeMF/1fG8SyVvMkbtgKY9v/bJ7nKcxZk/Chjyo5/81xfZ8CivHpJ1IjRSpBd7FqaT/q l7ufu8UIV3BtkuKZ3H1Ti8rnEIUwSEMpDjK+45ydk/zdynOfpwnwUkPVTVK4WL0L3dg== X-Gm-Gg: ASbGncs/smmSzZbQmer9KQfyQi58UBILOke1mN5fJnEsaawLBbauqZIlXtdEOhFX66A mFKOc5P99JPZh+MgqJJWy9z1pPv+X/uOHbCzbIkWIq27cN+HVMXqy7D/noxplHkVpI501u3XhjO TTGUj2FhzsJtWlNhmJmUMg5CBdlfC0YyFTPR6DZZmvNSZYalxluoNsfwETVSIhBmcztMdWfEviv j4Mrgnza3v42YC07yw8Y/as5oQXFH4w+h+bcx2+qafCpWFBeQWMATfELGAWIfd98a7Od4xTQa2V Pc5BDsmZ+eT5LmJmyqIFn6sw5TPZ+PtrDh9O6yAFFg8LQymLrBqBb7O7oJISf9ZIZ9rw2foroAg ZCg88Z0U9o6pqOmKJKxWZ62wzkFg= X-Received: by 2002:a05:600c:524b:b0:471:115e:87bd with SMTP id 5b1f17b1804b1-4792f38d616mr70704975e9.26.1764947988176; Fri, 05 Dec 2025 07:19:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFCot/KF5F65hplGg4xWSLyvS1jVC/e+gBoRR6TDiuo7BMwLsACBc72R7yqlYEmRSaUPcRuA== X-Received: by 2002:a05:600c:524b:b0:471:115e:87bd with SMTP id 5b1f17b1804b1-4792f38d616mr70704575e9.26.1764947987631; Fri, 05 Dec 2025 07:19:47 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a041:e294:5000:b694:8e49:4f51:966d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4792b021cd2sm74880785e9.1.2025.12.05.07.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 07:19:47 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Crystal Wood , Wander Lairson Costa , Costa Shulyupin , Ivan Pravdin , John Kacur , Tiezhu Yang , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v1 2/4] tools/rtla: Remove unneeded nr_cpus arguments Date: Fri, 5 Dec 2025 17:19:22 +0200 Message-ID: <20251205151924.2250142-2-costa.shul@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251205151924.2250142-1-costa.shul@redhat.com> References: <20251205151924.2250142-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: 8bit nr_cpus does not change at runtime, so passing it through function arguments is unnecessary. Use the global nr_cpus instead of propagating it via parameters. Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/osnoise_hist.c | 4 ++-- tools/tracing/rtla/src/osnoise_top.c | 4 ++-- tools/tracing/rtla/src/timerlat_bpf.c | 5 ++--- tools/tracing/rtla/src/timerlat_bpf.h | 6 ++---- tools/tracing/rtla/src/timerlat_hist.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_top.c | 19 +++++++------------ tools/tracing/rtla/src/timerlat_u.c | 6 +++--- 7 files changed, 25 insertions(+), 38 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index 0bed9717cef6..ae773334e700 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -63,7 +63,7 @@ static void osnoise_free_hist_tool(struct osnoise_tool *tool) * 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; @@ -704,7 +704,7 @@ static struct osnoise_tool if (!tool) return NULL; - tool->data = osnoise_alloc_histogram(nr_cpus, params->hist.entries, + tool->data = 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 8fa0046f0136..367a765387c8 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 *tool) /* * 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; @@ -548,7 +548,7 @@ struct osnoise_tool *osnoise_init_top(struct common_params *params) if (!tool) return NULL; - tool->data = osnoise_alloc_top(nr_cpus); + tool->data = 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 e97d16646bcd..4b623a904802 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -169,12 +169,11 @@ 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); } #endif /* HAVE_BPF_SKEL */ diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src/timerlat_bpf.h index 118487436d30..2b18f3061c32 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -27,8 +27,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); static inline int have_libbpf_support(void) { return 1; } #else @@ -52,8 +51,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/src/timerlat_hist.c index 37bb9b931c8c..d4a9dcd67d48 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_tool *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_tool *tool) /* Pull summary */ err = 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 = 0; i < data->nr_cpus; i++) { @@ -234,8 +233,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -245,8 +243,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -256,8 +253,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -267,8 +263,7 @@ static int timerlat_hist_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -1082,7 +1077,7 @@ static struct osnoise_tool if (!tool) return NULL; - tool->data = timerlat_alloc_histogram(nr_cpus, params->hist.entries, + tool->data = 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 8b15f4439c6c..7b62549f69e3 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -63,7 +63,7 @@ static void timerlat_free_top_tool(struct osnoise_tool *tool) /* * 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; @@ -197,8 +197,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) /* Pull summary */ err = 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 = 0; i < data->nr_cpus; i++) { @@ -208,8 +207,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -219,8 +217,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -230,8 +227,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -241,8 +237,7 @@ static int timerlat_top_bpf_pull_data(struct osnoise_tool *tool) } err = 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 = 0; i < data->nr_cpus; i++) { @@ -828,7 +823,7 @@ static struct osnoise_tool if (!top) return NULL; - top->data = timerlat_alloc_top(nr_cpus); + top->data = timerlat_alloc_top(); if (!top->data) goto out_err; diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/timerlat_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_params *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 = 0; int i, retval; @@ -169,7 +169,7 @@ void *timerlat_u_dispatcher(void *data) /* parent */ if (pid == -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); } - timerlat_u_send_kill(procs, nr_cpus); + timerlat_u_send_kill(procs); while (procs_count) { pid = waitpid(-1, &wstatus, 0); -- 2.52.0