diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2012-11-21 14:53:21 +0000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-11-28 18:37:59 +1000 |
commit | 82fe50bcc87e508e85250c87b745296a36a07897 (patch) | |
tree | 6fd205d9d0a92391e9bf5cf31a442a54992fe0b5 /drivers/gpu/drm/ttm/ttm_bo_vm.c | |
parent | 5293908afa04b651cc8a7e85ba0938b71f97c2f8 (diff) | |
download | lwn-82fe50bcc87e508e85250c87b745296a36a07897.tar.gz lwn-82fe50bcc87e508e85250c87b745296a36a07897.zip |
drm/ttm: Optimize vm locking using kref_get_unless_zero v3
Removes the need for a write lock each time we call ttm_bo_unref().
v2: Remove an unused variable.
v3: Really remove the unused variable.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo_vm.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 3ba72dbdc4bd..74705f329d99 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -259,8 +259,8 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, read_lock(&bdev->vm_lock); bo = ttm_bo_vm_lookup_rb(bdev, vma->vm_pgoff, (vma->vm_end - vma->vm_start) >> PAGE_SHIFT); - if (likely(bo != NULL)) - ttm_bo_reference(bo); + if (likely(bo != NULL) && !kref_get_unless_zero(&bo->kref)) + bo = NULL; read_unlock(&bdev->vm_lock); if (unlikely(bo == NULL)) { |