Commit 5915b89
tracing: Have saved_cmdlines arrays all in one allocation
[ Upstream commit 0b18c85 ]
The saved_cmdlines have three arrays for mapping PIDs to COMMs:
- map_pid_to_cmdline[]
- map_cmdline_to_pid[]
- saved_cmdlines
The map_pid_to_cmdline[] is PID_MAX_DEFAULT in size and holds the index
into the other arrays. The map_cmdline_to_pid[] is a mapping back to the
full pid as it can be larger than PID_MAX_DEFAULT. And the
saved_cmdlines[] just holds the COMMs associated to the pids.
Currently the map_pid_to_cmdline[] and saved_cmdlines[] are allocated
together (in reality the saved_cmdlines is just in the memory of the
rounding of the allocation of the structure as it is always allocated in
powers of two). The map_cmdline_to_pid[] array is allocated separately.
Since the rounding to a power of two is rather large (it allows for 8000
elements in saved_cmdlines), also include the map_cmdline_to_pid[] array.
(This drops it to 6000 by default, which is still plenty for most use
cases). This saves even more memory as the map_cmdline_to_pid[] array
doesn't need to be allocated.
Link: https://lore.kernel.org/linux-trace-kernel/20240212174011.068211d9@gandalf.local.home/
Link: https://lore.kernel.org/linux-trace-kernel/20240220140703.182330529@goodmis.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Vincent Donnefort <vdonnefort@google.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Mete Durlu <meted@linux.ibm.com>
Fixes: 44dc5c4 ("tracing: Fix wasted memory in saved_cmdlines logic")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 26c907b commit 5915b89
1 file changed
+8
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2316 | 2316 | | |
2317 | 2317 | | |
2318 | 2318 | | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
2319 | 2323 | | |
2320 | 2324 | | |
2321 | 2325 | | |
| |||
2330 | 2334 | | |
2331 | 2335 | | |
2332 | 2336 | | |
2333 | | - | |
2334 | 2337 | | |
2335 | 2338 | | |
2336 | 2339 | | |
| |||
2343 | 2346 | | |
2344 | 2347 | | |
2345 | 2348 | | |
2346 | | - | |
| 2349 | + | |
2347 | 2350 | | |
2348 | 2351 | | |
2349 | 2352 | | |
| |||
2355 | 2358 | | |
2356 | 2359 | | |
2357 | 2360 | | |
2358 | | - | |
| 2361 | + | |
2359 | 2362 | | |
2360 | 2363 | | |
2361 | | - | |
2362 | | - | |
2363 | | - | |
2364 | | - | |
2365 | | - | |
2366 | | - | |
2367 | | - | |
| 2364 | + | |
| 2365 | + | |
2368 | 2366 | | |
2369 | 2367 | | |
2370 | 2368 | | |
| |||
0 commit comments