Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2007 09:22:16 +0100
From:      Stefan Sperling <stsp@stsp.name>
To:        freebsd-ports@freebsd.org
Cc:        Bubble Reading <bubblereading@gmail.com>
Subject:   Re: Slab Allocator And Wait Queues
Message-ID:  <20071205082216.GB1996@ted.stsp.lan>
In-Reply-To: <4755FC3F.5020706@delphij.net>
References:  <a65132710712040624n47c41bb0sa3727e7cd53897be@mail.gmail.com> <4755FC3F.5020706@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Bn2rw/3z4jIqBvZU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 04, 2007 at 05:17:51PM -0800, Xin LI wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>=20
> Bubble Reading wrote:
> > Hi,
> >=20
> > Does someone know if there is something like Linux Slab Allocator and L=
inux
> > Wait Queues in FreeBSD?
> >=20
> > I am trying to port a linux code to FreeBSD which makes use of these.
>=20
> 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,=20
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 :)

--=20
stefan
http://stsp.name                                         PGP Key: 0xF59D25F0

--Bn2rw/3z4jIqBvZU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHVl+45dMCc/WdJfARAon+AKCdNHlesF1dD6MHzKZNweYX5o7sbgCgy8xt
9Z9Y4RzATGPmruLXtg9KfNg=
=4TXH
-----END PGP SIGNATURE-----

--Bn2rw/3z4jIqBvZU--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071205082216.GB1996>