MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bt_freehead_toalloc

Function bt_freehead_toalloc

freebsd/kern/subr_vmem.c:423–440  ·  view source on GitHub ↗

* bt_freehead_toalloc: return the freelist for the given size and allocation * strategy. * * For M_FIRSTFIT, return the list in which any blocks are large enough * for the requested size. otherwise, return the list which can have blocks * large enough for the requested size. */

Source from the content-addressed store, hash-verified

421 * large enough for the requested size.
422 */
423static struct vmem_freelist *
424bt_freehead_toalloc(vmem_t *vm, vmem_size_t size, int strat)
425{
426 const vmem_size_t qsize = size >> vm->vm_quantum_shift;
427 int idx = SIZE2ORDER(qsize);
428
429 MPASS(size != 0 && qsize != 0);
430 MPASS((size & vm->vm_quantum_mask) == 0);
431
432 if (strat == M_FIRSTFIT && ORDER2SIZE(idx) != qsize) {
433 idx++;
434 /* check too large request? */
435 }
436 MPASS(idx >= 0);
437 MPASS(idx < VMEM_MAXORDER);
438
439 return &vm->vm_freelist[idx];
440}
441
442/* ---- boundary tag hash */
443

Callers 1

vmem_xallocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected