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

Function vmspace_switch_aio

freebsd/vm/vm_map.c:501–525  ·  view source on GitHub ↗

* Switch between vmspaces in an AIO kernel process. * * The new vmspace is either the vmspace of a user process obtained * from an active AIO request or the initial vmspace of the AIO kernel * process (when it is idling). Because user processes will block to * drain any active AIO requests before proceeding in exit() or * execve(), the reference count for vmspaces from AIO requests can * n

Source from the content-addressed store, hash-verified

499 * vmspace_acquire_ref() above.
500 */
501void
502vmspace_switch_aio(struct vmspace *newvm)
503{
504 struct vmspace *oldvm;
505
506 /* XXX: Need some way to assert that this is an aio daemon. */
507
508 KASSERT(refcount_load(&newvm->vm_refcnt) > 0,
509 ("vmspace_switch_aio: newvm unreferenced"));
510
511 oldvm = curproc->p_vmspace;
512 if (oldvm == newvm)
513 return;
514
515 /*
516 * Point to the new address space and refer to it.
517 */
518 curproc->p_vmspace = newvm;
519 refcount_acquire(&newvm->vm_refcnt);
520
521 /* Activate the new mapping. */
522 pmap_activate(curthread);
523
524 vmspace_free(oldvm);
525}
526
527void
528_vm_map_lock(vm_map_t map, const char *file, int line)

Callers 3

soaio_kproc_loopFunction · 0.85
aio_switch_vmspaceFunction · 0.85
aio_daemonFunction · 0.85

Calls 4

refcount_loadFunction · 0.85
refcount_acquireFunction · 0.85
vmspace_freeFunction · 0.85
pmap_activateFunction · 0.50

Tested by

no test coverage detected