3af224c5cd
Currently, we use PTRACE_PEEKDATA to read things like filenames and data passed by I/O syscalls. PTRACE_PEEKDATA gets one word per syscall. This is VERY expensive. For example, in order to print fstat syscall, we need to perform more than twenty trips into kernel to fetch one struct stat! Kernel 3.2 got a new syscall, process_vm_readv(), which can be used to copy data blocks out of process' address space. This change uses it in umoven() and umovestr() functions if possible, with fallback to old method if process_vm_readv() fails. If it returns ENOSYS, we don't try to use it anymore, eliminating overhead of trying it on older kernels. Result of "time strace -oLOG ls -l /usr/lib >/dev/null": before patch: 0.372s After patch: 0.262s * util.c (process_vm_readv): Wrapper to call process_vm_readv syscall. (umoven): Use process_vm_readv for block reads of tracee memory. (umovestr): Likewise. * linux/syscall.h: Declare new function sys_process_vm_readv. * process.c (sys_process_vm_readv): Decoder for new syscall. * linux/i386/syscallent.h: Add process_vm_readv, process_vm_writev syscalls. * linux/x86_64/syscallent.h: Likewise. * linux/powerpc/syscallent.h: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> |
||
---|---|---|
.. | ||
errnoent1.h | ||
ioctlent1.h | ||
ioctlent.h.in | ||
signalent1.h | ||
syscallent1.h | ||
syscallent.h |