vm_object: Modify various drivers to allocate OBJT_SWAP objects
This is in preparation for removal of OBJT_DEFAULT. In particular, it is now cheap to check whether an OBJT_SWAP object has any swap blocks allocated, so the benefit of having a separate OBJT_DEFAULT type is quite marginal, and the OBJT_DEFAULT->SWAP transition is a source of bugs. Reviewed by: alc, hselasky, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35779
This commit is contained in:
parent
59219dde9a
commit
6b38974085
@ -697,7 +697,7 @@ vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
obj = vm_object_allocate(OBJT_DEFAULT, len >> PAGE_SHIFT);
|
||||
obj = vm_object_allocate(OBJT_SWAP, len >> PAGE_SHIFT);
|
||||
if (obj == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
|
@ -84,7 +84,7 @@ linux_shmem_file_setup(const char *name, loff_t size, unsigned long flags)
|
||||
|
||||
filp->f_count = 1;
|
||||
filp->f_vnode = vp;
|
||||
filp->f_shmem = vm_pager_allocate(OBJT_DEFAULT, NULL, size,
|
||||
filp->f_shmem = vm_pager_allocate(OBJT_SWAP, NULL, size,
|
||||
VM_PROT_READ | VM_PROT_WRITE, 0, curthread->td_ucred);
|
||||
if (filp->f_shmem == NULL) {
|
||||
error = -ENOMEM;
|
||||
|
@ -514,7 +514,7 @@ agp_generic_alloc_memory(device_t dev, int type, vm_size_t size)
|
||||
mem->am_id = sc->as_nextid++;
|
||||
mem->am_size = size;
|
||||
mem->am_type = 0;
|
||||
mem->am_obj = vm_object_allocate(OBJT_DEFAULT, atop(round_page(size)));
|
||||
mem->am_obj = vm_object_allocate(OBJT_SWAP, atop(round_page(size)));
|
||||
mem->am_physical = 0;
|
||||
mem->am_offset = 0;
|
||||
mem->am_is_bound = 0;
|
||||
|
@ -1744,7 +1744,7 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size)
|
||||
mem->am_size = size;
|
||||
mem->am_type = type;
|
||||
if (type != 1 && (type != 2 || size == AGP_PAGE_SIZE))
|
||||
mem->am_obj = vm_object_allocate(OBJT_DEFAULT,
|
||||
mem->am_obj = vm_object_allocate(OBJT_SWAP,
|
||||
atop(round_page(size)));
|
||||
else
|
||||
mem->am_obj = 0;
|
||||
|
@ -111,7 +111,7 @@ int drm_gem_object_init(struct drm_device *dev,
|
||||
("Bad size %ju", (uintmax_t)size));
|
||||
|
||||
obj->dev = dev;
|
||||
obj->vm_obj = vm_pager_allocate(OBJT_DEFAULT, NULL, size,
|
||||
obj->vm_obj = vm_pager_allocate(OBJT_SWAP, NULL, size,
|
||||
VM_PROT_READ | VM_PROT_WRITE, 0, curthread->td_ucred);
|
||||
|
||||
obj->refcount = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user