Slab Allocator And Wait Queues

Stefan Sperling stsp at stsp.name
Wed Dec 5 00:22:20 PST 2007


On Tue, Dec 04, 2007 at 05:17:51PM -0800, Xin LI wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Bubble Reading wrote:
> > Hi,
> > 
> > Does someone know if there is something like Linux Slab Allocator and Linux
> > Wait Queues in FreeBSD?
> > 
> > I am trying to port a linux code to FreeBSD which makes use of these.
> 
> Do you mean kernel code or userland code?

That is a vital piece of information missing...

> For slab allocator, FreeBSD provided a mechanism called "UMA" which
> provided similar functionality;

For the in-kernel case, yes. Specifically, take a look at uma_zcreate(9)

A question I have though: AFAIK, in Linux, SLAB would be used for
most in-kernel memory management if configured. For example, 
in DSLinux (Linux port to Nintendo DS, see http://dslinux.org),
we replaced SLAB with SLOB, because the latter is more space-efficient
on hardware with no MMU. IIRC, switching the allocator required no changes
to the kernel code whatsoever, it was all abstracted away by kalloc.
Doesn't FreeBSD's malloc(9) abstract the in-kernel memory allocation scheme
the same way?

> Wait queues...  We usually use msleep(9) and wakeup(9), but I am not
> sure if that is what you want...

Possibly kqueue(2) might also be of interest, but then again
we don't know yet what Mr. Reading wants exactly :)

-- 
stefan
http://stsp.name                                         PGP Key: 0xF59D25F0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20071205/1198ec3e/attachment.pgp


More information about the freebsd-ports mailing list