[nycbug-talk] Slab Allocator

Yarema yds at CoolRat.org
Thu Aug 28 17:01:26 EDT 2008

Marc Spitzer wrote:
> On Thu, Aug 28, 2008 at 5:15 AM, Yarema <yds at coolrat.org> wrote:
>> A while ago I read on Matt Dillon's DragonFly diary
>> http://www.DragonFlyBSD.org/status/diary.shtml
>> that
>> # DragonFly now has slab allocator for the kernel! The allocator is
>> about 1/3 the size of FreeBSD-5's slab allocator and features per-cpu
>> isolation, mutexless operation, cache sensitivity (locality of
>> reference), and optimized zeroing code.
>> # The core of the slab allocator is MP safe but at the moment we still
>> use the malloc_type structure for statistics reporting which is not yet
>> MP safe, and the backing store (KVM routines) are not MP safe. Even, so
>> making the whole thing MP safe is not expected to be difficult.
>> 1/3 the size of FreeBSD-5's slab allocator?!  that's awesome!  DragonFly
>> rulez!  er, WTF is a Slab Allocator?
> If I remember correctly, it is a in kernel memory allocator that
> operates under the assumption that I need to allocate lots of things
> that are the same size.  And that a good way to do this is to request
> a "slab" of memory from the memory allocator thingie and then manage
> it internally.  If the kernel was a deli think of it like the
> cornedbeef in the steam table.  You the deli guy manage the
> sandwitches locally but when you talk to the kitchen you can only ask
> for things in terms of a cornedbeef, or brisket, not in terms of I
> need 20 sandwitches.
> Let this be a lesson to you do not answer email when hungry.
> marc
>> it's still over my head, but here's where it all started:
>> http://Blogs.Sun.com/bonwick/en_US/category/Slab+Allocator
>> ... by the creator of ZFS no less.  Good story.

Seems like the Slab Allocator is forever doomed to being associated with
food from the very inception of its name. :)  Good deli analogy, BTW.
Now I get it much better.  Explains why there are Slab Allocators all
kinds of file systems as well as kernels.  I seem to recall reading that
the CODA slab allocator was particularly horrendous and full of "swill".


More information about the talk mailing list