This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Author Message
Joined: Jun 12, 2008
Posts: 4
Other Topics
Posted Jun 12, 2008 at 11:49:26 PM
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?
Back to top Profile Email Website
shamer
Joined Nov 04, 2007
Posts: 12

Other Topics
Posted: Jun 13, 2008 2:33:24 PM
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
Back to top Profile Email Website
thywyn
Joined Jun 12, 2008
Posts: 4

Other Topics
Posted: Jun 13, 2008 4:39:24 PM
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.
Back to top Profile Email Website
tophandcwby
Joined Apr 10, 2008
Posts: 81

Other Topics
Posted: Jun 13, 2008 5:32:48 PM
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
Back to top Profile Email Website
thywyn
Joined Jun 12, 2008
Posts: 4

Other Topics
Posted: Jun 13, 2008 6:35:42 PM
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.
Back to top Profile Email Website
tophandcwby
Joined Apr 10, 2008
Posts: 81

Other Topics
Posted: Jun 13, 2008 6:58:22 PM
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.
Back to top Profile Email Website
thywyn
Joined Jun 12, 2008
Posts: 4

Other Topics
Posted: Jun 13, 2008 9:20:06 PM
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.
Back to top Profile Email Website
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya