Date: Tue, 15 Apr 2008 11:06:18 +0100 (BST) From: Robert Watson <rwatson@FreeBSD.org> To: Volker <volker@vwsoft.com> Cc: hackers@freebsd.org Subject: Re: "visualize" kernel memory allocations Message-ID: <20080415105245.X14695@fledge.watson.org> In-Reply-To: <4803AE07.9010106@vwsoft.com> References: <4803AE07.9010106@vwsoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080415105245.X14695>