svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys

John Baldwin jhb at FreeBSD.org
Mon Dec 2 19:27:17 UTC 2019


On 11/21/19 4:50 PM, Keller, Jacob E wrote:
> On Fri, 2019-11-22 at 02:34 +0200, Konstantin Belousov wrote:
>> On Fri, Nov 22, 2019 at 12:25:00AM +0000, Keller, Jacob E wrote:
>>> On Fri, 2019-11-22 at 02:22 +0200, Konstantin Belousov wrote:
>>>> On Thu, Nov 21, 2019 at 09:52:54PM +0000, Keller, Jacob E wrote:
>>>>> We use a bit string as a method of determining which index
>>>>> numbers
>>>>> have
>>>>> been assigned.
>>>> For unit numbers we have unr(9) as well.
>>>
>>> Does unr have support for allocating contiguous sequences of unit
>>> numbers?
>>
>> No, it does not.  Although the data structure is optimized to track
>> contiguous runs, there is currently no API to allocate the chunk of
>> desired
>> length.
> 
> Hmm. Might make more sense to extend the API to allow requesting chunks
> of desired length, and then use that.

Well, there is also the rman structure which does handle runs.  However,
I think vmem is probably what you should use.  cxgbe(4) uses it to manage
sub-allocations of on-card memory for TLS keys and other buffers.  You can
write simple wrapper functions for your use case around vmem_* that the
rest of your driver can use.  I don't think it really makes sense to
extend bitstring or unr.  I think we should leave those for more specific
use cases and use vmem for cases that need a more general solution.

-- 
John Baldwin


More information about the svn-src-all mailing list