Re: [PATCH] procfs: add syscall statistics

From: Peter Zijlstra
Date: Fri May 27 2022 - 08:36:16 EST


On Fri, May 27, 2022 at 07:09:59PM +0800, Zhang Yuchen wrote:
> Add /proc/syscalls to display percpu syscall count.
>
> We need a less resource-intensive way to count syscall per cpu
> for system problem location.
>
> There is a similar utility syscount in the BCC project, but syscount
> has a high performance cost.
>
> The following is a comparison on the same machine, using UnixBench
> System Call Overhead:
>
> ┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
> ┃ Change ┃ Unixbench Score ┃ Loss ┃
> ┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
> │ no change │ 1072.6 │ --- │
> │ syscall count │ 982.5 │ 8.40% │
> │ bpf syscount │ 614.2 │ 42.74% │
> └───────────────┴─────────────────┴────────┘
>
> UnixBench System Call Use sys_gettid to test, this system call only reads
> one variable, so the performance penalty seems large. When tested with
> fork, the test scores were almost the same.
>
> So the conclusion is that it does not have a significant impact on system
> call performance.
>
> This function depends on CONFIG_FTRACE_SYSCALLS because the system call
> number is stored in syscall_metadata.

Death by a thousand cuts. 99% of people won't ever use this.

NAK