Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/rtla: Remove unneeded nr_cpus arguments

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 <costa.shul@redhat.com>
Link: https://lore.kernel.org/r/20260306194953.2511960-3-costa.shul@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>

authored by

Costa Shulyupin and committed by
Tomas Glozar
ea06305f 115b06a0

+34 -51
+2 -2
tools/tracing/rtla/src/osnoise_hist.c
··· 62 62 * osnoise_alloc_histogram - alloc runtime data 63 63 */ 64 64 static struct osnoise_hist_data 65 - *osnoise_alloc_histogram(int nr_cpus, int entries, int bucket_size) 65 + *osnoise_alloc_histogram(int entries, int bucket_size) 66 66 { 67 67 struct osnoise_hist_data *data; 68 68 int cpu; ··· 651 651 if (!tool) 652 652 return NULL; 653 653 654 - tool->data = osnoise_alloc_histogram(nr_cpus, params->hist.entries, 654 + tool->data = osnoise_alloc_histogram(params->hist.entries, 655 655 params->hist.bucket_size); 656 656 if (!tool->data) 657 657 goto out_err;
+2 -2
tools/tracing/rtla/src/osnoise_top.c
··· 51 51 /* 52 52 * osnoise_alloc_histogram - alloc runtime data 53 53 */ 54 - static struct osnoise_top_data *osnoise_alloc_top(int nr_cpus) 54 + static struct osnoise_top_data *osnoise_alloc_top(void) 55 55 { 56 56 struct osnoise_top_data *data; 57 57 ··· 495 495 if (!tool) 496 496 return NULL; 497 497 498 - tool->data = osnoise_alloc_top(nr_cpus); 498 + tool->data = osnoise_alloc_top(); 499 499 if (!tool->data) { 500 500 osnoise_destroy_tool(tool); 501 501 return NULL;
+8 -11
tools/tracing/rtla/src/timerlat_bpf.c
··· 147 147 int key, 148 148 long long *value_irq, 149 149 long long *value_thread, 150 - long long *value_user, 151 - int cpus) 150 + long long *value_user) 152 151 { 153 152 int err; 154 153 155 154 err = bpf_map__lookup_elem(map_irq, &key, 156 155 sizeof(unsigned int), value_irq, 157 - sizeof(long long) * cpus, 0); 156 + sizeof(long long) * nr_cpus, 0); 158 157 if (err) 159 158 return err; 160 159 err = bpf_map__lookup_elem(map_thread, &key, 161 160 sizeof(unsigned int), value_thread, 162 - sizeof(long long) * cpus, 0); 161 + sizeof(long long) * nr_cpus, 0); 163 162 if (err) 164 163 return err; 165 164 err = bpf_map__lookup_elem(map_user, &key, 166 165 sizeof(unsigned int), value_user, 167 - sizeof(long long) * cpus, 0); 166 + sizeof(long long) * nr_cpus, 0); 168 167 if (err) 169 168 return err; 170 169 return 0; ··· 175 176 int timerlat_bpf_get_hist_value(int key, 176 177 long long *value_irq, 177 178 long long *value_thread, 178 - long long *value_user, 179 - int cpus) 179 + long long *value_user) 180 180 { 181 181 return get_value(bpf->maps.hist_irq, 182 182 bpf->maps.hist_thread, 183 183 bpf->maps.hist_user, 184 - key, value_irq, value_thread, value_user, cpus); 184 + key, value_irq, value_thread, value_user); 185 185 } 186 186 187 187 /* ··· 189 191 int timerlat_bpf_get_summary_value(enum summary_field key, 190 192 long long *value_irq, 191 193 long long *value_thread, 192 - long long *value_user, 193 - int cpus) 194 + long long *value_user) 194 195 { 195 196 return get_value(bpf->maps.summary_irq, 196 197 bpf->maps.summary_thread, 197 198 bpf->maps.summary_user, 198 - key, value_irq, value_thread, value_user, cpus); 199 + key, value_irq, value_thread, value_user); 199 200 } 200 201 201 202 /*
+4 -8
tools/tracing/rtla/src/timerlat_bpf.h
··· 23 23 int timerlat_bpf_get_hist_value(int key, 24 24 long long *value_irq, 25 25 long long *value_thread, 26 - long long *value_user, 27 - int cpus); 26 + long long *value_user); 28 27 int timerlat_bpf_get_summary_value(enum summary_field key, 29 28 long long *value_irq, 30 29 long long *value_thread, 31 - long long *value_user, 32 - int cpus); 30 + long long *value_user); 33 31 int timerlat_load_bpf_action_program(const char *program_path); 34 32 static inline int have_libbpf_support(void) { return 1; } 35 33 #else ··· 43 45 static inline int timerlat_bpf_get_hist_value(int key, 44 46 long long *value_irq, 45 47 long long *value_thread, 46 - long long *value_user, 47 - int cpus) 48 + long long *value_user) 48 49 { 49 50 return -1; 50 51 } 51 52 static inline int timerlat_bpf_get_summary_value(enum summary_field key, 52 53 long long *value_irq, 53 54 long long *value_thread, 54 - long long *value_user, 55 - int cpus) 55 + long long *value_user) 56 56 { 57 57 return -1; 58 58 }
+8 -13
tools/tracing/rtla/src/timerlat_hist.c
··· 83 83 * timerlat_alloc_histogram - alloc runtime data 84 84 */ 85 85 static struct timerlat_hist_data 86 - *timerlat_alloc_histogram(int nr_cpus, int entries, int bucket_size) 86 + *timerlat_alloc_histogram(int entries, int bucket_size) 87 87 { 88 88 struct timerlat_hist_data *data; 89 89 int cpu; ··· 211 211 /* Pull histogram */ 212 212 for (i = 0; i < data->entries; i++) { 213 213 err = timerlat_bpf_get_hist_value(i, value_irq, value_thread, 214 - value_user, data->nr_cpus); 214 + value_user); 215 215 if (err) 216 216 return err; 217 217 for (j = 0; j < data->nr_cpus; j++) { ··· 223 223 224 224 /* Pull summary */ 225 225 err = timerlat_bpf_get_summary_value(SUMMARY_COUNT, 226 - value_irq, value_thread, value_user, 227 - data->nr_cpus); 226 + value_irq, value_thread, value_user); 228 227 if (err) 229 228 return err; 230 229 for (i = 0; i < data->nr_cpus; i++) { ··· 233 234 } 234 235 235 236 err = timerlat_bpf_get_summary_value(SUMMARY_MIN, 236 - value_irq, value_thread, value_user, 237 - data->nr_cpus); 237 + value_irq, value_thread, value_user); 238 238 if (err) 239 239 return err; 240 240 for (i = 0; i < data->nr_cpus; i++) { ··· 243 245 } 244 246 245 247 err = timerlat_bpf_get_summary_value(SUMMARY_MAX, 246 - value_irq, value_thread, value_user, 247 - data->nr_cpus); 248 + value_irq, value_thread, value_user); 248 249 if (err) 249 250 return err; 250 251 for (i = 0; i < data->nr_cpus; i++) { ··· 253 256 } 254 257 255 258 err = timerlat_bpf_get_summary_value(SUMMARY_SUM, 256 - value_irq, value_thread, value_user, 257 - data->nr_cpus); 259 + value_irq, value_thread, value_user); 258 260 if (err) 259 261 return err; 260 262 for (i = 0; i < data->nr_cpus; i++) { ··· 263 267 } 264 268 265 269 err = timerlat_bpf_get_summary_value(SUMMARY_OVERFLOW, 266 - value_irq, value_thread, value_user, 267 - data->nr_cpus); 270 + value_irq, value_thread, value_user); 268 271 if (err) 269 272 return err; 270 273 for (i = 0; i < data->nr_cpus; i++) { ··· 1040 1045 if (!tool) 1041 1046 return NULL; 1042 1047 1043 - tool->data = timerlat_alloc_histogram(nr_cpus, params->hist.entries, 1048 + tool->data = timerlat_alloc_histogram(params->hist.entries, 1044 1049 params->hist.bucket_size); 1045 1050 if (!tool->data) 1046 1051 goto out_err;
+7 -12
tools/tracing/rtla/src/timerlat_top.c
··· 62 62 /* 63 63 * timerlat_alloc_histogram - alloc runtime data 64 64 */ 65 - static struct timerlat_top_data *timerlat_alloc_top(int nr_cpus) 65 + static struct timerlat_top_data *timerlat_alloc_top(void) 66 66 { 67 67 struct timerlat_top_data *data; 68 68 int cpu; ··· 196 196 197 197 /* Pull summary */ 198 198 err = timerlat_bpf_get_summary_value(SUMMARY_CURRENT, 199 - value_irq, value_thread, value_user, 200 - data->nr_cpus); 199 + value_irq, value_thread, value_user); 201 200 if (err) 202 201 return err; 203 202 for (i = 0; i < data->nr_cpus; i++) { ··· 206 207 } 207 208 208 209 err = timerlat_bpf_get_summary_value(SUMMARY_COUNT, 209 - value_irq, value_thread, value_user, 210 - data->nr_cpus); 210 + value_irq, value_thread, value_user); 211 211 if (err) 212 212 return err; 213 213 for (i = 0; i < data->nr_cpus; i++) { ··· 216 218 } 217 219 218 220 err = timerlat_bpf_get_summary_value(SUMMARY_MIN, 219 - value_irq, value_thread, value_user, 220 - data->nr_cpus); 221 + value_irq, value_thread, value_user); 221 222 if (err) 222 223 return err; 223 224 for (i = 0; i < data->nr_cpus; i++) { ··· 226 229 } 227 230 228 231 err = timerlat_bpf_get_summary_value(SUMMARY_MAX, 229 - value_irq, value_thread, value_user, 230 - data->nr_cpus); 232 + value_irq, value_thread, value_user); 231 233 if (err) 232 234 return err; 233 235 for (i = 0; i < data->nr_cpus; i++) { ··· 236 240 } 237 241 238 242 err = timerlat_bpf_get_summary_value(SUMMARY_SUM, 239 - value_irq, value_thread, value_user, 240 - data->nr_cpus); 243 + value_irq, value_thread, value_user); 241 244 if (err) 242 245 return err; 243 246 for (i = 0; i < data->nr_cpus; i++) { ··· 786 791 if (!top) 787 792 return NULL; 788 793 789 - top->data = timerlat_alloc_top(nr_cpus); 794 + top->data = timerlat_alloc_top(); 790 795 if (!top->data) 791 796 goto out_err; 792 797
+3 -3
tools/tracing/rtla/src/timerlat_u.c
··· 99 99 * 100 100 * Return the number of processes that received the kill. 101 101 */ 102 - static int timerlat_u_send_kill(pid_t *procs, int nr_cpus) 102 + static int timerlat_u_send_kill(pid_t *procs) 103 103 { 104 104 int killed = 0; 105 105 int i, retval; ··· 169 169 170 170 /* parent */ 171 171 if (pid == -1) { 172 - timerlat_u_send_kill(procs, nr_cpus); 172 + timerlat_u_send_kill(procs); 173 173 debug_msg("Failed to create child processes"); 174 174 pthread_exit(&retval); 175 175 } ··· 196 196 sleep(1); 197 197 } 198 198 199 - timerlat_u_send_kill(procs, nr_cpus); 199 + timerlat_u_send_kill(procs); 200 200 201 201 while (procs_count) { 202 202 pid = waitpid(-1, &wstatus, 0);