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

Function vm_object_allocate

freebsd/vm/vm_object.c:413–446  ·  view source on GitHub ↗

* vm_object_allocate: * * Returns a new object with the given size. */

Source from the content-addressed store, hash-verified

411 * Returns a new object with the given size.
412 */
413vm_object_t
414vm_object_allocate(objtype_t type, vm_pindex_t size)
415{
416 vm_object_t object;
417 u_short flags;
418
419 switch (type) {
420 case OBJT_DEAD:
421 panic("vm_object_allocate: can't create OBJT_DEAD");
422 case OBJT_DEFAULT:
423 case OBJT_SWAP:
424 flags = OBJ_COLORED;
425 break;
426 case OBJT_DEVICE:
427 case OBJT_SG:
428 flags = OBJ_FICTITIOUS | OBJ_UNMANAGED;
429 break;
430 case OBJT_MGTDEVICE:
431 flags = OBJ_FICTITIOUS;
432 break;
433 case OBJT_PHYS:
434 flags = OBJ_UNMANAGED;
435 break;
436 case OBJT_VNODE:
437 flags = 0;
438 break;
439 default:
440 panic("vm_object_allocate: type %d is undefined", type);
441 }
442 object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK);
443 _vm_object_allocate(type, size, flags, object, NULL);
444
445 return (object);
446}
447
448/*
449 * vm_object_allocate_anon:

Callers 8

vm_alloc_memsegFunction · 0.85
cdev_pager_allocateFunction · 0.85
sg_pager_allocFunction · 0.85
kstack_cache_initFunction · 0.85
phys_pager_allocateFunction · 0.85
default_pager_allocFunction · 0.85
swap_pager_alloc_initFunction · 0.85
vnode_pager_allocFunction · 0.85

Calls 3

_vm_object_allocateFunction · 0.85
uma_zallocFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected