diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2009-08-17 10:28:39 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-08-19 02:09:53 -0400 |
commit | 5fd9cbad3a4ae82c83c55b9c621d156c326724ef (patch) | |
tree | 1a0868a3bd2751fa861c083aeb3ac27f3f695694 /drivers/gpu/drm/ttm/ttm_global.c | |
parent | e9840be8c23601285a70520b4898818f28ce8c2b (diff) |
drm/ttm: Memory accounting rework.
Use inclusive zones to simplify accounting and its sysfs representation.
Use DMA32 accounting where applicable.
Add a sysfs interface to make the heuristically determined limits
readable and configurable.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_global.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_global.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_global.c b/drivers/gpu/drm/ttm/ttm_global.c index 0b14eb1972b..541744d00d3 100644 --- a/drivers/gpu/drm/ttm/ttm_global.c +++ b/drivers/gpu/drm/ttm/ttm_global.c | |||
@@ -71,7 +71,7 @@ int ttm_global_item_ref(struct ttm_global_reference *ref) | |||
71 | 71 | ||
72 | mutex_lock(&item->mutex); | 72 | mutex_lock(&item->mutex); |
73 | if (item->refcount == 0) { | 73 | if (item->refcount == 0) { |
74 | item->object = kmalloc(ref->size, GFP_KERNEL); | 74 | item->object = kzalloc(ref->size, GFP_KERNEL); |
75 | if (unlikely(item->object == NULL)) { | 75 | if (unlikely(item->object == NULL)) { |
76 | ret = -ENOMEM; | 76 | ret = -ENOMEM; |
77 | goto out_err; | 77 | goto out_err; |
@@ -89,7 +89,6 @@ int ttm_global_item_ref(struct ttm_global_reference *ref) | |||
89 | mutex_unlock(&item->mutex); | 89 | mutex_unlock(&item->mutex); |
90 | return 0; | 90 | return 0; |
91 | out_err: | 91 | out_err: |
92 | kfree(item->object); | ||
93 | mutex_unlock(&item->mutex); | 92 | mutex_unlock(&item->mutex); |
94 | item->object = NULL; | 93 | item->object = NULL; |
95 | return ret; | 94 | return ret; |
@@ -105,7 +104,6 @@ void ttm_global_item_unref(struct ttm_global_reference *ref) | |||
105 | BUG_ON(ref->object != item->object); | 104 | BUG_ON(ref->object != item->object); |
106 | if (--item->refcount == 0) { | 105 | if (--item->refcount == 0) { |
107 | ref->release(ref); | 106 | ref->release(ref); |
108 | kfree(item->object); | ||
109 | item->object = NULL; | 107 | item->object = NULL; |
110 | } | 108 | } |
111 | mutex_unlock(&item->mutex); | 109 | mutex_unlock(&item->mutex); |