summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_context.c
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2008-10-13 18:03:27 +0000
committerrnoland <rnoland@FreeBSD.org>2008-10-13 18:03:27 +0000
commit192b3600be5db1effa54d2e72717a7482aaeb52a (patch)
tree9afb72dec01dcbe8a080c5adf1bdbdde1abd41bd /sys/dev/drm/drm_context.c
parent0d37976f3d86d7805a29299cc21e4b517b824aac (diff)
downloadFreeBSD-src-192b3600be5db1effa54d2e72717a7482aaeb52a.zip
FreeBSD-src-192b3600be5db1effa54d2e72717a7482aaeb52a.tar.gz
Rework memory allocation to allocate memory with different type names. This
will ease the identification of memory leaks as the OS will be able to track allocations for us by malloc type. vmstat -m will show all of the allocations. Convert the calls to drm_alloc() and friends, which are used in shared code to static __inline__ while we are here. Approved by: jhb (mentor)
Diffstat (limited to 'sys/dev/drm/drm_context.c')
-rw-r--r--sys/dev/drm/drm_context.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/drm/drm_context.c b/sys/dev/drm/drm_context.c
index d72ab86..41ac0c6 100644
--- a/sys/dev/drm/drm_context.c
+++ b/sys/dev/drm/drm_context.c
@@ -80,7 +80,7 @@ int drm_ctxbitmap_next(struct drm_device *dev)
ctx_sareas = realloc(dev->context_sareas,
dev->max_context * sizeof(*dev->context_sareas),
- M_DRM, M_NOWAIT);
+ DRM_MEM_SAREA, M_NOWAIT);
if (ctx_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
DRM_UNLOCK();
@@ -91,7 +91,8 @@ int drm_ctxbitmap_next(struct drm_device *dev)
} else {
/* max_context == 1 at this point */
dev->context_sareas = malloc(dev->max_context *
- sizeof(*dev->context_sareas), M_DRM, M_NOWAIT);
+ sizeof(*dev->context_sareas), DRM_MEM_SAREA,
+ M_NOWAIT);
if (dev->context_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
DRM_UNLOCK();
@@ -110,7 +111,8 @@ int drm_ctxbitmap_init(struct drm_device *dev)
int temp;
DRM_LOCK();
- dev->ctx_bitmap = malloc(PAGE_SIZE, M_DRM, M_NOWAIT | M_ZERO);
+ dev->ctx_bitmap = malloc(PAGE_SIZE, DRM_MEM_CTXBITMAP,
+ M_NOWAIT | M_ZERO);
if (dev->ctx_bitmap == NULL) {
DRM_UNLOCK();
return ENOMEM;
@@ -131,8 +133,8 @@ void drm_ctxbitmap_cleanup(struct drm_device *dev)
{
DRM_LOCK();
if (dev->context_sareas != NULL)
- free(dev->context_sareas, M_DRM);
- free(dev->ctx_bitmap, M_DRM);
+ free(dev->context_sareas, DRM_MEM_SAREA);
+ free(dev->ctx_bitmap, DRM_MEM_CTXBITMAP);
DRM_UNLOCK();
}
OpenPOWER on IntegriCloud