Date: Wed, 10 May 2017 12:19:46 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Sebastian Huber <sebastian.huber@embedded-brains.de> Cc: FreeBSD <freebsd-hackers@freebsd.org> Subject: Re: Linux gen_pool allocator replacement? Message-ID: <20170510091946.GT1622@kib.kiev.ua> In-Reply-To: <5912D448.5060201@embedded-brains.de> References: <5912D448.5060201@embedded-brains.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 10, 2017 at 10:50:16AM +0200, Sebastian Huber wrote: > Hello, > > I try currently to port a BSD licensed Linux network interface driver to > FreeBSD. This driver uses the gen_pool allocator > > http://elixir.free-electrons.com/linux/latest/source/include/linux/genalloc.h > > for example here > > https://github.com/torvalds/linux/blob/master/drivers/soc/fsl/qbman/qman.c#L2707 > > Does someone know if something similar exits in the FreeBSD kernel? I > cannot use UMA since the pool management data must reside outside the > managed memory area. One use case in this driver seems just to manage a I think you would get more useful answers if you explain what the facility does. > range of integers, so no actual memory allocation. For this I could > probably use UNR(9), but a general gen_pool allocator replacement would > be nice. For an abstract resource allocator, look at vmem(9). It manages arbitrary resources represented by ranges of integer values, you can use the range of size 1. There is no man page for vmem(9), but the interface is clearly explained in sys/vmem.h, and there is an article by Jeff Bonwick and Jonathan Adams about vmem, describing the original Solaris facility.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170510091946.GT1622>