[PATCH 2/2] UBUNTU: SAUCE: trace: add trace events for open(), exec() and uselib()
apw at canonical.com
Thu Oct 29 11:00:05 UTC 2009
On Tue, Oct 27, 2009 at 10:05:32AM +0000, Scott James Remnant wrote:
> This patch uses TRACE_EVENT to add tracepoints for the open(),
> exec() and uselib() syscalls so that ureadahead can cheaply trace
> the boot sequence to determine what to read to speed up the next.
> It's not upstream because it will need to be rebased onto the syscall
> trace events whenever that gets merged, and is a stop-gap.
> Signed-off-by: Scott James Remnant <scott at ubuntu.com>
> fs/exec.c | 8 +++++
> fs/open.c | 4 ++
> include/trace/events/fs.h | 71 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 83 insertions(+), 0 deletions(-)
> create mode 100644 include/trace/events/fs.h
> diff --git a/fs/exec.c b/fs/exec.c
> index 172ceb6..c936999 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -56,6 +56,8 @@
> #include <linux/fsnotify.h>
> #include <linux/fs_struct.h>
> +#include <trace/events/fs.h>
> #include <asm/uaccess.h>
> #include <asm/mmu_context.h>
> #include <asm/tlb.h>
> @@ -130,6 +132,10 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
> + tmp = getname(library);
> + trace_uselib(tmp);
> + putname(library);
So the other two tracepoints look basically sane and cheap when off.
This one does add this getname/putname pair. This appears to allocate
another copy of the filename and copy it from userspace.
getname() may fail to allocate memory and return a failure code, as the
trace point does not appear to check the string is valid would you not
need to check ERR_PTR(tmp) before calling the tracepint.
Can we not just hold the current filename a smidge longer and use that one,
that would be a lot less expensive me thinks if slightly more complex as
a patch. This would make sure we could log it if we did it and avoid
More information about the kernel-team