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

Function free_pv_entry

freebsd/amd64/amd64/pmap.c:5123–5149  ·  view source on GitHub ↗

* free the pv_entry back to the free list */

Source from the content-addressed store, hash-verified

5121 * free the pv_entry back to the free list
5122 */
5123static void
5124free_pv_entry(pmap_t pmap, pv_entry_t pv)
5125{
5126 struct pv_chunk *pc;
5127 int idx, field, bit;
5128
5129 PMAP_LOCK_ASSERT(pmap, MA_OWNED);
5130 PV_STAT(atomic_add_long(&pv_entry_frees, 1));
5131 PV_STAT(atomic_add_int(&pv_entry_spare, 1));
5132 PV_STAT(atomic_subtract_long(&pv_entry_count, 1));
5133 pc = pv_to_chunk(pv);
5134 idx = pv - &pc->pc_pventry[0];
5135 field = idx / 64;
5136 bit = idx % 64;
5137 pc->pc_map[field] |= 1ul << bit;
5138 if (pc->pc_map[0] != PC_FREE0 || pc->pc_map[1] != PC_FREE1 ||
5139 pc->pc_map[2] != PC_FREE2) {
5140 /* 98% of the time, pc is already at the head of the list. */
5141 if (__predict_false(pc != TAILQ_FIRST(&pmap->pm_pvchunk))) {
5142 TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
5143 TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
5144 }
5145 return;
5146 }
5147 TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
5148 free_pv_chunk(pc);
5149}
5150
5151static void
5152free_pv_chunk_dequeued(struct pv_chunk *pc)

Callers 3

pmap_pvh_freeFunction · 0.70
pmap_remove_allFunction · 0.70
pmap_enterFunction · 0.70

Calls 4

atomic_add_longFunction · 0.85
atomic_subtract_longFunction · 0.85
pv_to_chunkFunction · 0.70
free_pv_chunkFunction · 0.70

Tested by

no test coverage detected