On Mon, 14 Apr 2008, Volker wrote:
I need to hunt kernel memory allocations done by a kld. Unfortunately the
kld in question is a blob, no access to source code, so I need to check for
kmem_alloc() + kmem_malloc() + kmem_free() and print information from there
to the console screen.
From within these functions, I need to get the name (or an ID) of the
module trying to allocate memory (and display that or - better - filter some
allocations out).
Once DTrace is in the tree, it will be possible to do this sort of thing
automatically, but in the mean time, you might consider using KTR to trace
those kernel allocator calls along with stack(9) to generate traces. I
believe there's a variant of the CTR trace call that automatically collects
stack traces. You can then filter it down to ones that pass through the kld
of interest.
BTW, does the module directly call those allocator functions? You might want
to run nm on the module to look at what kernel functions it explictly depends
on. While I'm aware of modules that do directly invoke the low-level
allocators, most will prefer to use our higher level malloc(9) and uma(9)
interfaces (for good reason).
Robert N M Watson
Computer Laboratory
University of Cambridge
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"