Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 May 2017 08:34:09 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD <freebsd-hackers@freebsd.org>
Subject:   Re: Linux gen_pool allocator replacement?
Message-ID:  <591405E1.1000204@embedded-brains.de>
In-Reply-To: <20170510091946.GT1622@kib.kiev.ua>
References:  <5912D448.5060201@embedded-brains.de> <20170510091946.GT1622@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/05/17 11:19, Konstantin Belousov wrote:
> 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/gen=
alloc.h
>>
>> for example here
>>
>> https://github.com/torvalds/linux/blob/master/drivers/soc/fsl/qbman/qm=
an.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 woul=
d
>> be nice.
> For an abstract resource allocator, look at vmem(9).  It manages arbitr=
ary
> resources represented by ranges of integer values, you can use the rang=
e
> of size 1.
>
> There is no man page for vmem(9), but the interface is clearly explaine=
d
> in sys/vmem.h, and there is an article by Jeff Bonwick and Jonathan
> Adams about vmem, describing the original Solaris facility.

Thanks for the hint to vmem(9). There seems to be already a=20
driver-specific support using blist for gen_pool:

https://github.com/freebsd/freebsd/blob/master/sys/dev/cxgb/ulp/iw_cxgb/i=
w_cxgb_hal.h#L190

--=20
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine gesch=E4ftliche Mitteilung im Sinne des EHUG.




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