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

Function vm_phys_free_contig

freebsd/vm/vm_phys.c:1196–1222  ·  view source on GitHub ↗

* Free a contiguous, arbitrarily sized set of physical pages. * * The free page queues must be locked. */

Source from the content-addressed store, hash-verified

1194 * The free page queues must be locked.
1195 */
1196void
1197vm_phys_free_contig(vm_page_t m, u_long npages)
1198{
1199 int order_start, order_end;
1200 vm_page_t m_start, m_end;
1201
1202 vm_domain_free_assert_locked(vm_pagequeue_domain(m));
1203
1204 m_start = m;
1205 order_start = max_order(m_start);
1206 if (order_start < VM_NFREEORDER - 1)
1207 m_start += 1 << order_start;
1208 m_end = m + npages;
1209 order_end = max_order(m_end);
1210 if (order_end < VM_NFREEORDER - 1)
1211 m_end -= 1 << order_end;
1212 /*
1213 * Avoid unnecessary coalescing by freeing the pages at the start and
1214 * end of the range last.
1215 */
1216 if (m_start < m_end)
1217 vm_phys_enqueue_contig(m_start, m_end - m_start);
1218 if (order_start < VM_NFREEORDER - 1)
1219 vm_phys_free_pages(m, order_start);
1220 if (order_end < VM_NFREEORDER - 1)
1221 vm_phys_free_pages(m_end, order_end);
1222}
1223
1224/*
1225 * Scan physical memory between the specified addresses "low" and "high" for a

Callers

nothing calls this directly

Calls 4

vm_pagequeue_domainFunction · 0.85
max_orderFunction · 0.85
vm_phys_enqueue_contigFunction · 0.85
vm_phys_free_pagesFunction · 0.85

Tested by

no test coverage detected