Re: [PATCH] kmap tracking

From: Randy.Dunlap
Date: Tue May 23 2006 - 14:39:31 EST


On Mon, 22 May 2006 09:43:24 -0700 Zach Brown wrote:

> 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 :)

Yes.

> > +#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.

What warnings? I built the config option =y and =n and didn't see
any warnings. (not that I mind changing it)

> > +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 :).

noisy how/where?

> > +#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..

I dunno. I'll test it some. I thought that there were some
problems with __builtin_return_address(1), but I don't know for sure.

---
~Randy
-
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/