Repository navigation
Commit eb81b5a
tracing: Resize tgid_map to pid_max, not PID_MAX_DEFAULT
commit 4030a6e upstream.
Currently tgid_map is sized at PID_MAX_DEFAULT entries, which means that
on systems where pid_max is configured higher than PID_MAX_DEFAULT the
ftrace record-tgid option doesn't work so well. Any tasks with PIDs
higher than PID_MAX_DEFAULT are simply not recorded in tgid_map, and
don't show up in the saved_tgids file.
In particular since systemd v243 & above configure pid_max to its
highest possible 1<<22 value by default on 64 bit systems this renders
the record-tgids option of little use.
Increase the size of tgid_map to the configured pid_max instead,
allowing it to cover the full range of PIDs up to the maximum value of
PID_MAX_LIMIT if the system is configured that way.
On 64 bit systems with pid_max == PID_MAX_LIMIT this will increase the
size of tgid_map from 256KiB to 16MiB. Whilst this 64x increase in
memory overhead sounds significant 64 bit systems are presumably best
placed to accommodate it, and since tgid_map is only allocated when the
record-tgid option is actually used presumably the user would rather it
spends sufficient memory to actually record the tgids they expect.
The size of tgid_map could also increase for CONFIG_BASE_SMALL=y
configurations, but these seem unlikely to be systems upon which people
are both configuring a large pid_max and running ftrace with record-tgid
anyway.
Of note is that we only allocate tgid_map once, the first time that the
record-tgid option is enabled. Therefore its size is only set once, to
the value of pid_max at the time the record-tgid option is first
enabled. If a user increases pid_max after that point, the saved_tgids
file will not contain entries for any tasks with pids beyond the earlier
value of pid_max.
Link: https://lkml.kernel.org/r/20210701172407.889626-2-paulburton@google.com
Fixes: d914ba3 ("tracing: Add support for recording tgid of tasks")
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joel Fernandes <joelaf@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Paul Burton <paulburton@google.com>
[ Fixed comment coding style ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 3cda5b7 commit eb81b5a
1 file changed
Lines changed: 47 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2181 | 2181 | | |
2182 | 2182 | | |
2183 | 2183 | | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
2184 | 2188 | | |
2185 | 2189 | | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
2186 | 2193 | | |
2187 | 2194 | | |
2188 | 2195 | | |
| |||
2455 | 2462 | | |
2456 | 2463 | | |
2457 | 2464 | | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
2458 | 2480 | | |
2459 | 2481 | | |
2460 | | - | |
2461 | | - | |
| 2482 | + | |
2462 | 2483 | | |
2463 | | - | |
| 2484 | + | |
2464 | 2485 | | |
2465 | 2486 | | |
2466 | 2487 | | |
2467 | 2488 | | |
| 2489 | + | |
| 2490 | + | |
2468 | 2491 | | |
2469 | 2492 | | |
2470 | 2493 | | |
2471 | 2494 | | |
2472 | | - | |
| 2495 | + | |
| 2496 | + | |
2473 | 2497 | | |
2474 | 2498 | | |
2475 | | - | |
| 2499 | + | |
2476 | 2500 | | |
2477 | 2501 | | |
2478 | 2502 | | |
| |||
4847 | 4871 | | |
4848 | 4872 | | |
4849 | 4873 | | |
| 4874 | + | |
| 4875 | + | |
4850 | 4876 | | |
4851 | 4877 | | |
4852 | 4878 | | |
| |||
4869 | 4895 | | |
4870 | 4896 | | |
4871 | 4897 | | |
4872 | | - | |
4873 | | - | |
4874 | | - | |
4875 | | - | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
4876 | 4911 | | |
4877 | 4912 | | |
4878 | 4913 | | |
| |||
5286 | 5321 | | |
5287 | 5322 | | |
5288 | 5323 | | |
5289 | | - | |
5290 | | - | |
5291 | | - | |
5292 | | - | |
| 5324 | + | |
5293 | 5325 | | |
5294 | 5326 | | |
5295 | 5327 | | |
5296 | 5328 | | |
5297 | | - | |
5298 | | - | |
| 5329 | + | |
5299 | 5330 | | |
5300 | | - | |
| 5331 | + | |
5301 | 5332 | | |
5302 | 5333 | | |
5303 | 5334 | | |
| |||
0 commit comments