Initialize the uvm object when we actually need it such that we can
authorkettenis <kettenis@openbsd.org>
Thu, 2 Sep 2021 19:12:29 +0000 (19:12 +0000)
committerkettenis <kettenis@openbsd.org>
Thu, 2 Sep 2021 19:12:29 +0000 (19:12 +0000)
use uvm_obj_init() to initialize the pager ops and initial reference count.
This will help future uvm unlocking diffs.

ok mpi@, jsg@

sys/dev/pci/drm/ttm/ttm_bo.c
sys/dev/pci/drm/ttm/ttm_bo_vm.c

index c2abe4a..83bfa2e 100644 (file)
@@ -1167,7 +1167,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
        }
        bo->destroy = destroy ? destroy : ttm_bo_default_destroy;
 
-       uvm_obj_init(&bo->base.uobj, NULL, 0);
        kref_init(&bo->kref);
        INIT_LIST_HEAD(&bo->lru);
        INIT_LIST_HEAD(&bo->ddestroy);
index 94beca6..cd70004 100644 (file)
@@ -971,8 +971,7 @@ ttm_bo_mmap(struct file *filp, voff_t off, vsize_t size,
        if (unlikely(ret != 0))
                goto out_unref;
 
-       bo->base.uobj.pgops = &ttm_bo_vm_ops;
-       bo->base.uobj.uo_refs++;
+       uvm_obj_init(&bo->base.uobj, &ttm_bo_vm_ops, 1);
        return &bo->base.uobj;
 out_unref:
        ttm_bo_put(bo);