Re: [RFC PATCH 1/4] kmemtrace: Core implementation.

From: Randy Dunlap
Date: Thu Jul 17 2008 - 17:34:48 EST


On Thu, 17 Jul 2008 03:46:45 +0300 Eduard - Gabriel Munteanu wrote:

> kmemtrace provides tracing for slab allocator functions, such as kmalloc,
> kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected data is then fed
> to the userspace application in order to analyse allocation hotspots,
> internal fragmentation and so on, making it possible to see how well an
> allocator performs, as well as debug and profile kernel code.
>
> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
> ---
> Documentation/kernel-parameters.txt | 6 +
> Documentation/vm/kmemtrace.txt | 96 ++++++++++++++++
> MAINTAINERS | 6 +
> include/linux/kmemtrace.h | 110 ++++++++++++++++++
> init/main.c | 2 +
> lib/Kconfig.debug | 4 +
> mm/Makefile | 2 +-
> mm/kmemtrace.c | 208 +++++++++++++++++++++++++++++++++++
> 8 files changed, 433 insertions(+), 1 deletions(-)
> create mode 100644 Documentation/vm/kmemtrace.txt
> create mode 100644 include/linux/kmemtrace.h
> create mode 100644 mm/kmemtrace.c
>
> diff --git a/Documentation/vm/kmemtrace.txt b/Documentation/vm/kmemtrace.txt
> new file mode 100644
> index 0000000..1147ecb
> --- /dev/null
> +++ b/Documentation/vm/kmemtrace.txt

> +II. Quick usage guide
> +=====================
> +
> +1) Get a kernel that supports kmemtrace and build it accordingly (i.e. enable
> +CONFIG_KMEMTRACE).
> +
> +2) Get the userspace tool and build it:
> +$ git-clone git://repo.or.cz/kmemtrace-user.git # current repository
> +$ cd kmemtrace-user/
> +$ autoreconf
> +$ ./configure # Supply KERNEL_SOURCES=/path/to/sources/ if you're
> + # _not_ running this on a kmemtrace-enabled kernel.
> +$ make
> +
> +3) Boot the kmemtrace-enabled kernel if you haven't, preferably in the
> +'single' runlevel (so that relay buffers don't fill up easily), and run
> +kmemtrace:
> +# '$' does not mean user, but root here.
> +$ mount -t debugfs none /debug

Please mount at /sys/kernel/debug, i.e., the expected debugfs mount point.

> +$ mount -t proc none /proc
> +$ cd path/to/kmemtrace-user/
> +$ ./kmemtraced
> +Wait a bit, then stop it with CTRL+C.
> +$ cat /debug/kmemtrace/total_overruns # Check if we didn't overrun, should
> + # be zero.
> +$ (Optionally) [Run kmemtrace_check separately on each cpu[0-9]*.out file to
> + check its correctness]
> +$ ./kmemtrace-report
> +
> +Now you should have a nice and short summary of how the allocator performs.


Otherwise looks nice. Thanks.

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/