From 951f4dd61fccad97b6204ac347ace9c9270202c7 Mon Sep 17 00:00:00 2001 From: kettenis Date: Thu, 2 Sep 2021 19:12:29 +0000 Subject: [PATCH] Initialize the uvm object when we actually need it such that we can 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 | 1 - sys/dev/pci/drm/ttm/ttm_bo_vm.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c index c2abe4a6cae..83bfa2ea2e9 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo.c +++ b/sys/dev/pci/drm/ttm/ttm_bo.c @@ -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); diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c index 94beca6e476..cd70004f7b3 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c @@ -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); -- 2.20.1