Scripts for slab allocator

William Cohen wcohen@redhat.com
Wed Nov 7 20:11:00 GMT 2007


Hi,

I have been looking at instrumenting the slab allocator in the kernel. I have 
written a couple of scripts to collect data to give people a better idea what is 
going on with the slab allocator. I am looking for feedback on the scripts. 
Currently they don't work with the 2.6.24 kernels (or things using the slub 
allocator). I know that the tokenize() function isn't need for newer versions of 
stap.

The slabuse2.stp script takes a string listing the slab object that it should 
monitor. The second argument is a threshold when to collect data. When the 
number allocations of an object is greater than the number of frees for that 
object stack backtraces are recorded. When the script is stopped with a 
control-c it prints out the top 20 slab allocations and top 20 stack back 
traces. For example:

  stap  slabuse2.stp -g "ext3_inode_cache dentry_cache" 100

The cache_grow.stp records backtraces for for the various times that slabs need 
to be grown in size.

I would like to extend these to work with newer kernels and provide better 
rendering of information. Comments?


-Will
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: slabuse2.stp
URL: <http://sourceware.org/pipermail/systemtap/attachments/20071107/2f30f29c/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cache_grow.stp
URL: <http://sourceware.org/pipermail/systemtap/attachments/20071107/2f30f29c/attachment-0001.ksh>


More information about the Systemtap mailing list