iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

tools/memleak: Use compact size of key for sizes and memptrs maps #4867

Closed Bojun-Seo closed 8 months ago

Bojun-Seo commented 8 months ago

As sizes and memptrs map are to store the temporal information of each thread, use only tid portion of the return value of bpf_get_current_pid_tgid as a key of sizes and memptrs map. This change could reduce the key size of each map from 64 bits to 32 bits. The lower 32 bits portion of the return value of bpf_get_current_pid_tgid is kernel's view of the pid, which in user space is usually presented as the tid.

Please refer this document for further information: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#4-bpf_get_current_pid_tgid

yonghong-song commented 8 months ago

Right, tid should work.