diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2012-11-06 06:31:50 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-11-20 01:15:05 -0500 |
commit | cdad05216c2b2edfe92a9f87d6ae51aab277f3b2 (patch) | |
tree | 1ba899709b77745acec655d0a8eea3f08c97a885 /include | |
parent | 4b20db3de8dab005b07c74161cb041db8c5ff3a7 (diff) |
drm/ttm, drm/vmwgfx: Use RCU locking for object lookups v3
The mostly used lookup+get put+potential_destroy path of TTM objects
is converted to use RCU locks. This will substantially decrease the amount
of locked bus cycles during normal operation.
Since we use kfree_rcu to free the objects, no rcu synchronization is needed
at module unload time.
v2: Don't touch include/linux/kref.h
v3: Adapt to kref_get_unless_zero return value change
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/ttm/ttm_object.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h index b01c563b2751..fc0cf0649901 100644 --- a/include/drm/ttm/ttm_object.h +++ b/include/drm/ttm/ttm_object.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/list.h> | 40 | #include <linux/list.h> |
41 | #include <drm/drm_hashtab.h> | 41 | #include <drm/drm_hashtab.h> |
42 | #include <linux/kref.h> | 42 | #include <linux/kref.h> |
43 | #include <linux/rcupdate.h> | ||
43 | #include <ttm/ttm_memory.h> | 44 | #include <ttm/ttm_memory.h> |
44 | 45 | ||
45 | /** | 46 | /** |
@@ -120,6 +121,7 @@ struct ttm_object_device; | |||
120 | */ | 121 | */ |
121 | 122 | ||
122 | struct ttm_base_object { | 123 | struct ttm_base_object { |
124 | struct rcu_head rhead; | ||
123 | struct drm_hash_item hash; | 125 | struct drm_hash_item hash; |
124 | enum ttm_object_type object_type; | 126 | enum ttm_object_type object_type; |
125 | bool shareable; | 127 | bool shareable; |
@@ -268,4 +270,6 @@ extern struct ttm_object_device *ttm_object_device_init | |||
268 | 270 | ||
269 | extern void ttm_object_device_release(struct ttm_object_device **p_tdev); | 271 | extern void ttm_object_device_release(struct ttm_object_device **p_tdev); |
270 | 272 | ||
273 | #define ttm_base_object_kfree(__object, __base)\ | ||
274 | kfree_rcu(__object, __base.rhead) | ||
271 | #endif | 275 | #endif |