On Tue, 22 Oct 2019 15:51:04 -0400 Steven Rostedt <rost...@goodmis.org> wrote:
> > static struct syscall_metadata *syscall_nr_to_meta(int nr) > > { > > - if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) > > - return NULL; > > - > > - return syscalls_metadata[nr]; > > + return xa_load(&syscalls_metadata, (unsigned long)nr); > > } > > There appears to be a slight overhead to this for archs that do not have a sparse syscall array. I wonder if we should make this only applicable for archs (via adding a HAVE_SPARSE_SYSCALL_NR define and checking against it). Then if an arch doesn't have a sparse array of system calls, it uses a normal lookup, but for archs that do, it can define this for this type of lookup. There's not much to this patch, so it wouldn't be too difficult to support both methods. Without this patch I ran: # trace-cmd start -e syscalls # /work/c/hackbench 50 Time: 15.702 # /work/c/hackbench 50 Time: 15.932 # /work/c/hackbench 50 Time: 15.893 # /work/c/hackbench 50 Time: 16.038 # /work/c/hackbench 50 Time: 15.429 With the patch it had: # trace-cmd start -e syscalls # /work/c/hackbench 50 Time: 16.582 # /work/c/hackbench 50 Time: 15.972 # /work/c/hackbench 50 Time: 16.078 # /work/c/hackbench 50 Time: 16.133 # /work/c/hackbench 50 Time: 16.263 -- Steve