Re: [PATCH] kmap tracking

From: Zach Brown
Date: Mon May 22 2006 - 12:42:40 EST


Randy.Dunlap wrote:
> From: Randy Dunlap <rdunlap@xxxxxxxxxxxx>
>
> Track kmap/kunmap call history, storing caller function address,
> action, and time (jiffies), if CONFIG_DEBUG_KMAP is enabled.
> Based on a patch to 2.4.21 by Zach Brown that was used successfully
> at Oracle to track down some kmap/kunmap problems.

Thanks for bringing this to 2.6.. sorry for the lag in reviewing.

> +enum {
> + KMAP_FIRST = 1,
> + KMAP_ADDREF,
> + KMAP_DECREF,
> + KMAP_LAST,
> +};

I trust you got rid of these in the most recent version :)

> +#else
> +#define kmap_record_action(nr, action, refcount, retaddr) do {} while (0)
> +#endif

Make this an inline, please, so that we don't introduce unused var warnings.

> +static __init int kmap_history_init(void)
> +{
> + kmap_history_file = debugfs_create_file("kmap-history", 0644, NULL,
> + kh_running, &kmap_running_seq_fops);
> + if (!kmap_history_file)
> + goto out1;
> +
> + return 0;
> +
> +out1:
> + return -ENOMEM;

That seems noisy.. return -ENOMEM is probably fine for such a trivial
funciton :).

> +#define kmap(page) __kmap(page, __builtin_return_address(0))
> +#define kunmap(page) __kunmap(page, __builtin_return_address(0))

Hmm, I was hoping we wouldn't have to do this. Can we use
__builtin_return_address(1) from within the debug paths instead of
passing down (0)? Then we wouldn't have to ifdef around the declarations..

- z
-
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/