Kernel Memory Allocator Dcmds
-
thread
::allocdby
-
Given the address of a kernel thread, print a list of memory allocations it has performed in reverse chronological order.
-
bufctl
::bufctl
[-a
address] [-c
caller] [-e
earliest] [-l
latest] [-t
thread] -
Print a summary of the bufctl information for the specified bufctl address. If one or more options are present, the bufctl information is printed only if it matches the criteria defined by the option arguments; in this way, the dcmd can be used as a filter for input from a pipeline. The
-a
option indicates that the bufctl's corresponding buffer address must equal the specified address. The-c
option indicates that a program counter value from the specified caller must be present in the bufctl's saved stack trace. The-e
option indicates that the bufctl's timestamp must be greater than or equal to the specified earliest timestamp. The-l
option indicates that the bufctl's timestamp must be less than or equal to the specified latest timestamp. The-t
option indicates that the bufctl's thread pointer must be equal to the specified thread address. -
[ address ]
::findleaks
[-v
] -
The
::findleaks
dcmd provides powerful and efficient detection of memory leaks in kernel crash dumps where the full set of kmem debug features has been enabled. The first execution of::findleaks
processes the dump for memory leaks (this can take a few minutes), then coalesces the leaks by the allocation stack trace. The findleaks report shows a bufctl address and the topmost stack frame for each memory leak that was identified.If the
-v
option is specified, the dcmd prints more verbose messages as it executes. If an explicit address is specified prior to the dcmd, the report is filtered and only leaks whose allocation stack traces contain the specified function address are displayed. -
thread
::freedby
-
Given the address of a kernel thread, print a list of memory frees it has performed, in reverse chronological order.
-
value
::kgrep
-
Search the kernel address space for pointer-aligned addresses that contain the specified pointer-sized value. The list of addresses that contain matching values is then printed. Unlike MDB's built-in search operators,
::kgrep
searches every segment of the kernel's address space and searches across discontiguous segment boundaries. On large kernels,::kgrep
can take a considerable amount of time to execute. -
::kmalog
[slab
|fail
] -
Display events in a kernel memory allocator transaction log. Events are displayed in time-reverse order, with the most recent event displayed first. For each event,
::kmalog
displays the time relative to the most recent event in T-minus notation (for example, T-0.000151879), the bufctl, the buffer address, the kmem cache name, and the stack trace at the time of the event. Without arguments,::kmalog
displays the kmem transaction log, which is present only ifKMF_AUDIT
is set inkmem_flags
.::kmalog
fail
displays the allocation failure log, which is always present; this can be useful in debugging drivers that don't cope with allocation failure correctly.::kmalog
slab
displays the slab create log, which is always present.::kmalog
slab
can be useful when searching for memory leaks. -
::kmastat
-
Display the list of kernel memory allocator caches and virtual memory arenas, along with corresponding statistics.
-
::kmausers
[-ef
] [cache ...] -
Print information about the medium and large users of the kernel memory allocator that have current memory allocations. The output consists of one entry for each unique stack trace specifying the total amount of memory and number of allocations that was made with that stack trace. This dcmd requires that the
KMF_AUDIT
flag is set inkmem_flags
.If one or more cache names (for example,
kmem_alloc_256
) are specified, the scan of memory usage is restricted to those caches. By default all caches are included. If the-e
option is used, the small users of the allocator are included. The small users are allocations that total less than 1024 bytes of memory or for which there are less than 10 allocations with the same stack trace. If the-f
option is used, the stack traces are printed for each individual allocation. -
[ address ]
::kmem_cache
-
Format and display the
kmem_cache
structure stored at the specified address, or the complete set of activekmem_cache
structures. -
::kmem_log
-
Display the complete set of kmem transaction logs, sorted in reverse chronological order. This dcmd uses a more concise tabular output format than
::kmalog
. -
[ address ]
::kmem_verify
-
Verify the integrity of the
kmem_cache
structure stored at the specified address, or the complete set of activekmem_cache
structures. If an explicit cache address is specified, the dcmd displays more verbose information regarding errors; otherwise, a summary report is displayed. The::kmem_verify
dcmd is discussed in more detail in Kernel Memory Caches. -
[ address]
::vmem
-
Format and display the
vmem
structure stored at the specified address, or the complete set of activevmem
structures. This structure is defined in<sys/vmem_impl.h>
. -
address
::vmem_seg
-
Format and display the
vmem_seg
structure stored at the specified address. This structure is defined in<sys/vmem_impl.h>
. -
address
::whatis
[-abv
] -
Report information about the specified address. In particular,
::whatis
will attempt to determine if the address is a pointer to a kmem-managed buffer or another type of special memory region, such as a thread stack, and report its findings. If the-a
option is present, the dcmd reports all matches instead of just the first match to its queries. If the-b
option is present, the dcmd also attempts to determine if the address is referred to by a known kmembufctl
. If the-v
option is present, the dcmd reports its progress as it searches various kernel data structures.