Which memory allocator is my kernel using
Author Message
Posted : Thu, 12 June 2008 23:49:26
Subject : Which memory allocator is my kernel using
I'm wondering is there a script/program/method to determine which memory allocator (slab, slub, or slob) the kernel is using?
shamer
Posted : Fri, 13 June 2008 14:33:24
Subject : Which memory allocator is my kernel using
egrep "SLAB|SLOB|SLUB" /usr/src/linux/.config I'm using SLUB, as the output shows: CONFIG_SLUB_DEBUG=y <---------------- # CONFIG_SLAB is not set CONFIG_SLUB=y <---------------- # CONFIG_SLOB is not set CONFIG_SLABINFO=n # CONFIG_SLUB_DEBUG_ON is not set
thywyn
Posted : Fri, 13 June 2008 16:39:24
Subject : Which memory allocator is my kernel using
Thanks for the reply. I guess I should be more specific. Looking at the .config in the kernel's source location is an "ok" method, but it is fallible. You have to make the assumption that you have the same kernel loaded from that source location, it doesn't necessarily tell you how the kernel you have currently loaded is configured. Perhaps I'm a bit paranoid, but I'm just looking to see if there is an easy way to query the kernel itself.
tophandcwby
Posted : Fri, 13 June 2008 17:32:48
Subject : Which memory allocator is my kernel using
Try cat /proc/meminfo | egrep -i "SLAB|SLOB|SLUB" or egrep -i "SLAB|SLOB|SLUB" /proc/meminfo
thywyn
Posted : Fri, 13 June 2008 18:35:42
Subject : Which memory allocator is my kernel using
unfortunately, slub and slob where made as dropin replacements for slab.. so the "Slab: xxxxx kB" reported doesn't indicate the type of management used. At least this is my understanding. Please correct me if I'm wrong.
tophandcwby
Posted : Fri, 13 June 2008 18:58:22
Subject : Which memory allocator is my kernel using
My kernel was compiled with slab. So I can't test for anything else. Did you actually run the commands suggested by shamer and me? Another thing to try cat /proc/kallsyms | egrep -i "slab|slub|slob" If you can't trust the symbols table, then I don''t think there is any way to do it. If every symbol refers to slub or slob as slab, then you will have to compile a kernel with your settings in .config to know for sure.
thywyn
Posted : Fri, 13 June 2008 21:20:06
Subject : Which memory allocator is my kernel using
yes, I did look into those commands. The last one I think will work for my purposes. The absence of slub and slob in the /proc/kallsyms, I would think, definitely indicates that slab is being used. Thank you both for your help.