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

Function vm_reserv_populate

freebsd/vm/vm_reserv.c:568–608  ·  view source on GitHub ↗

* Increases the given reservation's population count. Moves the reservation * to the tail of the partially populated reservation queue. */

Source from the content-addressed store, hash-verified

566 * to the tail of the partially populated reservation queue.
567 */
568static void
569vm_reserv_populate(vm_reserv_t rv, int index)
570{
571
572 vm_reserv_assert_locked(rv);
573 CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d",
574 __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq);
575 KASSERT(rv->object != NULL,
576 ("vm_reserv_populate: reserv %p is free", rv));
577 KASSERT(popmap_is_clear(rv->popmap, index),
578 ("vm_reserv_populate: reserv %p's popmap[%d] is set", rv,
579 index));
580 KASSERT(rv->popcnt < VM_LEVEL_0_NPAGES,
581 ("vm_reserv_populate: reserv %p is already full", rv));
582 KASSERT(rv->pages->psind == 0,
583 ("vm_reserv_populate: reserv %p is already promoted", rv));
584 KASSERT(rv->domain < vm_ndomains,
585 ("vm_reserv_populate: reserv %p's domain is corrupted %d",
586 rv, rv->domain));
587 popmap_set(rv->popmap, index);
588 rv->popcnt++;
589 if ((unsigned)(ticks - rv->lasttick) < PARTPOPSLOP &&
590 rv->inpartpopq && rv->popcnt != VM_LEVEL_0_NPAGES)
591 return;
592 rv->lasttick = ticks;
593 vm_reserv_domain_lock(rv->domain);
594 if (rv->inpartpopq) {
595 TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq);
596 rv->inpartpopq = FALSE;
597 }
598 if (rv->popcnt < VM_LEVEL_0_NPAGES) {
599 rv->inpartpopq = TRUE;
600 TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, partpopq);
601 } else {
602 KASSERT(rv->pages->psind == 0,
603 ("vm_reserv_populate: reserv %p is already promoted",
604 rv));
605 rv->pages->psind = 1;
606 }
607 vm_reserv_domain_unlock(rv->domain);
608}
609
610/*
611 * Allocates a contiguous set of physical pages of the given size "npages"

Callers 2

vm_reserv_alloc_contigFunction · 0.85
vm_reserv_alloc_pageFunction · 0.85

Calls 2

popmap_is_clearFunction · 0.85
popmap_setFunction · 0.85

Tested by

no test coverage detected