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

Function swap_pager_alloc_init

freebsd/vm/swap_pager.c:657–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657static vm_object_t
658swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size,
659 vm_ooffset_t offset)
660{
661 vm_object_t object;
662
663 if (cred != NULL) {
664 if (!swap_reserve_by_cred(size, cred))
665 return (NULL);
666 crhold(cred);
667 }
668
669 /*
670 * The un_pager.swp.swp_blks trie is initialized by
671 * vm_object_allocate() to ensure the correct order of
672 * visibility to other threads.
673 */
674 object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset +
675 PAGE_MASK + size));
676
677 object->un_pager.swp.writemappings = 0;
678 object->handle = handle;
679 if (cred != NULL) {
680 object->cred = cred;
681 object->charge = size;
682 }
683 return (object);
684}
685
686/*
687 * SWAP_PAGER_ALLOC() - allocate a new OBJT_SWAP VM object and instantiate

Callers 1

swap_pager_allocFunction · 0.85

Calls 3

swap_reserve_by_credFunction · 0.85
vm_object_allocateFunction · 0.85
crholdFunction · 0.50

Tested by

no test coverage detected