Commit 4094583
authored
profiler: Reduce mem usage in maps with no filters (#1588)
Right now we always allocate 5k entries in `debug_pids` in kernel memory
even if the filter mode `--debug-process-names` is not enabled. Let's
only allocate the entries if we are filtering processes.
The saved memory isn't too much, around a few KB, but kernel memory is
precious and in particular this memory, as it's locked.
Test Plan
=========
**no filters**
```
[javierhonduco@fedora parca-agent]$ sudo bpftool map | grep debug_pids -A3
739: hash name debug_pids flags 0x0
key 4B value 1B max_entries 1 memlock 4096B
btf_id 670
pids parca-agent-deb(154991)
```
**with filters**
```
[javierhonduco@fedora parca-agent]$ sudo bpftool map | grep debug_pids -A3
765: hash name debug_pids flags 0x0
key 4B value 1B max_entries 5000 memlock 40960B
btf_id 697
pids parca-agent-deb(156286)
```3 files changed
+15
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
293 | | - | |
| 294 | + | |
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | | - | |
| 300 | + | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
307 | 318 | | |
308 | 319 | | |
309 | 320 | | |
| |||
0 commit comments