Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345359
b: refs/heads/master
c: 5293908
h: refs/heads/master
i:
  345357: f25f468
  345355: c7976e4
  345351: 85575c9
  345343: b8d0a94
v: v3
  • Loading branch information
Thomas Hellstrom authored and Dave Airlie committed Nov 28, 2012
1 parent cda239c commit 752506b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae8df2ae8aa27bfeb8d1b99e8adaac5810a97fa8
refs/heads/master: 5293908afa04b651cc8a7e85ba0938b71f97c2f8
21 changes: 14 additions & 7 deletions trunk/drivers/gpu/drm/ttm/ttm_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
base->refcount_release = refcount_release;
base->ref_obj_release = ref_obj_release;
base->object_type = object_type;
spin_lock(&tdev->object_lock);
kref_init(&base->refcount);
ret = drm_ht_just_insert_please(&tdev->object_hash,
&base->hash,
(unsigned long)base, 31, 0, 0);
spin_lock(&tdev->object_lock);
ret = drm_ht_just_insert_please_rcu(&tdev->object_hash,
&base->hash,
(unsigned long)base, 31, 0, 0);
spin_unlock(&tdev->object_lock);
if (unlikely(ret != 0))
goto out_err0;
Expand All @@ -175,7 +175,7 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
return 0;
out_err1:
spin_lock(&tdev->object_lock);
(void)drm_ht_remove_item(&tdev->object_hash, &base->hash);
(void)drm_ht_remove_item_rcu(&tdev->object_hash, &base->hash);
spin_unlock(&tdev->object_lock);
out_err0:
return ret;
Expand All @@ -189,8 +189,15 @@ static void ttm_release_base(struct kref *kref)
struct ttm_object_device *tdev = base->tfile->tdev;

spin_lock(&tdev->object_lock);
(void)drm_ht_remove_item(&tdev->object_hash, &base->hash);
(void)drm_ht_remove_item_rcu(&tdev->object_hash, &base->hash);
spin_unlock(&tdev->object_lock);

/*
* Note: We don't use synchronize_rcu() here because it's far
* too slow. It's up to the user to free the object using
* call_rcu() or ttm_base_object_kfree().
*/

if (base->refcount_release) {
ttm_object_file_unref(&base->tfile);
base->refcount_release(&base);
Expand All @@ -216,7 +223,7 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
int ret;

rcu_read_lock();
ret = drm_ht_find_item(&tdev->object_hash, key, &hash);
ret = drm_ht_find_item_rcu(&tdev->object_hash, key, &hash);

if (likely(ret == 0)) {
base = drm_hash_entry(hash, struct ttm_base_object, hash);
Expand Down

0 comments on commit 752506b

Please sign in to comment.