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

Function default_phys_pager_populate

freebsd/vm/phys_pager.c:230–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228#define PHYSALLOC 16
229
230static int
231default_phys_pager_populate(vm_object_t object, vm_pindex_t pidx,
232 int fault_type __unused, vm_prot_t max_prot __unused, vm_pindex_t *first,
233 vm_pindex_t *last)
234{
235 vm_page_t m;
236 vm_pindex_t base, end, i;
237 int ahead;
238
239 base = rounddown(pidx, phys_pager_cluster);
240 end = base + phys_pager_cluster - 1;
241 if (end >= object->size)
242 end = object->size - 1;
243 if (*first > base)
244 base = *first;
245 if (end > *last)
246 end = *last;
247 *first = base;
248 *last = end;
249
250 for (i = base; i <= end; i++) {
251 ahead = MIN(end - i, PHYSALLOC);
252 m = vm_page_grab(object, i,
253 VM_ALLOC_NORMAL | VM_ALLOC_COUNT(ahead));
254 if (!vm_page_all_valid(m))
255 vm_page_zero_invalid(m, TRUE);
256 KASSERT(m->dirty == 0,
257 ("phys_pager_populate: dirty page %p", m));
258 }
259 return (VM_PAGER_OK);
260}
261
262static int
263phys_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type,

Callers

nothing calls this directly

Calls 3

vm_page_grabFunction · 0.85
vm_page_all_validFunction · 0.85
vm_page_zero_invalidFunction · 0.85

Tested by

no test coverage detected