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

Function vm_object_populate

freebsd/vm/vm_object.c:2195–2221  ·  view source on GitHub ↗

* Populate the specified range of the object with valid pages. Returns * TRUE if the range is successfully populated and FALSE otherwise. * * Note: This function should be optimized to pass a larger array of * pages to vm_pager_get_pages() before it is applied to a non- * OBJT_DEVICE object. * * The object must be locked. */

Source from the content-addressed store, hash-verified

2193 * The object must be locked.
2194 */
2195boolean_t
2196vm_object_populate(vm_object_t object, vm_pindex_t start, vm_pindex_t end)
2197{
2198 vm_page_t m;
2199 vm_pindex_t pindex;
2200 int rv;
2201
2202 VM_OBJECT_ASSERT_WLOCKED(object);
2203 for (pindex = start; pindex < end; pindex++) {
2204 rv = vm_page_grab_valid(&m, object, pindex, VM_ALLOC_NORMAL);
2205 if (rv != VM_PAGER_OK)
2206 break;
2207
2208 /*
2209 * Keep "m" busy because a subsequent iteration may unlock
2210 * the object.
2211 */
2212 }
2213 if (pindex > start) {
2214 m = vm_page_lookup(object, start);
2215 while (m != NULL && m->pindex < pindex) {
2216 vm_page_xunbusy(m);
2217 m = TAILQ_NEXT(m, listq);
2218 }
2219 }
2220 return (pindex == end);
2221}
2222
2223/*
2224 * Routine: vm_object_coalesce

Callers 3

pmap_object_init_ptFunction · 0.85
pmap_object_init_ptFunction · 0.85

Calls 2

vm_page_grab_validFunction · 0.85
vm_page_lookupFunction · 0.85

Tested by

no test coverage detected