Repository navigation
Commit 1d2865b
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 3816490 commit 1d2865b
1 file changed
Lines changed: 47 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2184 | 2184 | | |
2185 | 2185 | | |
2186 | 2186 | | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
2187 | 2191 | | |
2188 | 2192 | | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
2189 | 2196 | | |
2190 | 2197 | | |
2191 | 2198 | | |
| |||
2458 | 2465 | | |
2459 | 2466 | | |
2460 | 2467 | | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
2461 | 2483 | | |
2462 | 2484 | | |
2463 | | - | |
2464 | | - | |
| 2485 | + | |
2465 | 2486 | | |
2466 | | - | |
| 2487 | + | |
2467 | 2488 | | |
2468 | 2489 | | |
2469 | 2490 | | |
2470 | 2491 | | |
| 2492 | + | |
| 2493 | + | |
2471 | 2494 | | |
2472 | 2495 | | |
2473 | 2496 | | |
2474 | 2497 | | |
2475 | | - | |
| 2498 | + | |
| 2499 | + | |
2476 | 2500 | | |
2477 | 2501 | | |
2478 | | - | |
| 2502 | + | |
2479 | 2503 | | |
2480 | 2504 | | |
2481 | 2505 | | |
| |||
5171 | 5195 | | |
5172 | 5196 | | |
5173 | 5197 | | |
| 5198 | + | |
| 5199 | + | |
5174 | 5200 | | |
5175 | 5201 | | |
5176 | 5202 | | |
| |||
5193 | 5219 | | |
5194 | 5220 | | |
5195 | 5221 | | |
5196 | | - | |
5197 | | - | |
5198 | | - | |
5199 | | - | |
| 5222 | + | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
| 5229 | + | |
| 5230 | + | |
| 5231 | + | |
| 5232 | + | |
| 5233 | + | |
| 5234 | + | |
5200 | 5235 | | |
5201 | 5236 | | |
5202 | 5237 | | |
| |||
5610 | 5645 | | |
5611 | 5646 | | |
5612 | 5647 | | |
5613 | | - | |
5614 | | - | |
5615 | | - | |
5616 | | - | |
| 5648 | + | |
5617 | 5649 | | |
5618 | 5650 | | |
5619 | 5651 | | |
5620 | 5652 | | |
5621 | | - | |
5622 | | - | |
| 5653 | + | |
5623 | 5654 | | |
5624 | | - | |
| 5655 | + | |
5625 | 5656 | | |
5626 | 5657 | | |
5627 | 5658 | | |
| |||
0 commit comments