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

libbpf-tools/biotop:Add PID filter support #4810

Closed zhangting9756 closed 10 months ago

zhangting9756 commented 10 months ago

-p option for tracking a specific pid in tools/biotop which filters target PID to avoid message flooding. So, adding -p option to filter pid is necessary.

zhangting9756 commented 10 months ago

@pchengcui

pchengcui commented 10 months ago

@chenhengqi @yonghong-song can you review this PR ? thanks.

yonghong-song commented 10 months ago

I think this pid filtering thing may not work in such cases, e.g., blk_account_io_start() is often not called in sycall process context. When an IO operation is initialized by user space, the kernel in general will do blk_queue_bio() to queue the IO and returns to the user space. Later blk_account_io_start() will be done by per-cpu IO thread (maybe something else). So I am not sure this pid based filtering works or not for blk_account_io_start(). Similarly, the same case for other functions.

pchengcui commented 10 months ago

I think this pid filtering thing may not work in such cases, e.g., blk_account_io_start() is often not called in sycall process context. When an IO operation is initialized by user space, the kernel in general will do blk_queue_bio() to queue the IO and returns to the user space. Later blk_account_io_start() will be done by per-cpu IO thread (maybe something else). So I am not sure this pid based filtering works or not for blk_account_io_start(). Similarly, the same case for other functions.

Thanks for the reply, PID may be lost in this case. However, this situation is in the minority, and I think it is acceptable. This situation may also exist in the corresponding /tools/biotop.py.

yonghong-song commented 10 months ago

Okay, will merge the patch since we have biotop precedence.