Linux gen_pool allocator replacement?

Konstantin Belousov kostikbel at gmail.com
Wed May 10 09:20:01 UTC 2017


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.


More information about the freebsd-hackers mailing list