Re: [patch 07/10] Linux Kernel Markers - Documentation

Christoph Hellwig
2007-05-10T12:01:16Z

> +They can be used for tracing (LTTng, LKET over SystemTAP), overall performance
> +accounting (SystemTAP). They could also be used to implement
> +efficient hooks for SELinux or any other subsystem that would have this
> +kind of need.
> +
> +Using the markers for system audit (SELinux) would require to pass a
> +variable by address that would be later checked by the marked routine.

I don't think you should mention abuses like the selinux one, nor odd
projects that aren't merged. Just make this a generic:

"The can be used for tracing or performance accounting"

> +* Usage
> +
> +In order to use the macro MARK, you should include linux/marker.h.

It's trace_mark now.

> +* Optimization for a given architecture
> +
> +You will find, in asm-*/marker.h, optimisations for given architectures
> +(currently i386 and powerpc). They use a load immediate instead of a data load,
> +which saves a data cache hit, but also requires cross CPU code modification. In
> +order to support embedded systems which use read-only memory for their code, the
> +optimization can be disabled through menu options.

I'm not sure this belong in here. As we already have good example it's
probably not needed at all.

> +#include <linux/sched.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/marker.h>
> +#include <asm/atomic.h>
> +
> +#define NUM_PROBES ARRAY_SIZE(probe_array)

no need for this macro.

> +static int __init probe_init(void)
> +{
> + int result;
> + uint8_t eID;

please call the loop variable i and use int for it.