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

Function bt_freetrim

freebsd/kern/subr_vmem.c:339–358  ·  view source on GitHub ↗

* Trim the per-vmem free list. Returns with the lock released to * avoid allocator recursions. */

Source from the content-addressed store, hash-verified

337 * avoid allocator recursions.
338 */
339static void
340bt_freetrim(vmem_t *vm, int freelimit)
341{
342 LIST_HEAD(, vmem_btag) freetags;
343 bt_t *bt;
344
345 LIST_INIT(&freetags);
346 VMEM_ASSERT_LOCKED(vm);
347 while (vm->vm_nfreetags > freelimit) {
348 bt = LIST_FIRST(&vm->vm_freetags);
349 LIST_REMOVE(bt, bt_freelist);
350 vm->vm_nfreetags--;
351 LIST_INSERT_HEAD(&freetags, bt, bt_freelist);
352 }
353 VMEM_UNLOCK(vm);
354 while ((bt = LIST_FIRST(&freetags)) != NULL) {
355 LIST_REMOVE(bt, bt_freelist);
356 uma_zfree(vmem_bt_zone, bt);
357 }
358}
359
360static inline void
361bt_free(vmem_t *vm, bt_t *bt)

Callers 3

vmem_destroy1Function · 0.85
vmem_try_releaseFunction · 0.85
vmem_xfreeFunction · 0.85

Calls 1

uma_zfreeFunction · 0.50

Tested by

no test coverage detected