Commit ea3632a
bpf: refactor max_depth computation in bpf_get_stack()
A new helper function stack_map_calculate_max_depth() that
computes the max depth for a stackmap.
Changes in v2:
- Removed the checking 'map_size % map_elem_size' from
stack_map_calculate_max_depth
- Changed stack_map_calculate_max_depth params name to be more generic
Changes in v3:
- Changed map size param to size in max depth helper
Changes in v4:
- Fixed indentation in max depth helper for args
Changes in v5:
- Bound back trace_nr to num_elem in __bpf_get_stack
- Make a copy of sysctl_perf_event_max_stack
in stack_map_calculate_max_depth
Changes in v6:
- Restrained max_depth computation only when required
- Additional cleanup from Song in __bpf_get_stack
Changes in v7:
- Removed additional cleanup from v6
Link to v6: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Arnaud Lecomte <[email protected]>
Acked-by: Yonghong Song <[email protected]>1 parent 4754b79 commit ea3632a
1 file changed
+27
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
45 | 67 | | |
46 | 68 | | |
47 | 69 | | |
| |||
300 | 322 | | |
301 | 323 | | |
302 | 324 | | |
303 | | - | |
304 | | - | |
| 325 | + | |
305 | 326 | | |
306 | 327 | | |
307 | 328 | | |
| 329 | + | |
308 | 330 | | |
309 | 331 | | |
310 | 332 | | |
311 | 333 | | |
312 | 334 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 335 | + | |
317 | 336 | | |
318 | 337 | | |
319 | 338 | | |
| |||
406 | 425 | | |
407 | 426 | | |
408 | 427 | | |
409 | | - | |
410 | 428 | | |
| 429 | + | |
411 | 430 | | |
412 | 431 | | |
413 | 432 | | |
| |||
438 | 457 | | |
439 | 458 | | |
440 | 459 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
| 460 | + | |
445 | 461 | | |
446 | 462 | | |
447 | 463 | | |
| |||
0 commit comments