diff options
author | Robert Noland <rnoland@2hip.net> | 2008-10-10 13:06:22 -0400 |
---|---|---|
committer | Robert Noland <rnoland@2hip.net> | 2008-10-10 13:06:22 -0400 |
commit | cdd3e9fc562bd57e0272e4c4d1c0707776bd01a1 (patch) | |
tree | 97d7b554a5c040630fabcb693b7b26ab4ca5a9f1 /bsd-core/drm_sysctl.c | |
parent | 1150a42d4398b14c5db2f34a5beba613528df147 (diff) |
[FreeBSD] Rework all of the memory allocations
Allocate memory from different pools. This allows the OS to track memory
allocations for us, much like the linux memory debugging. This will ease
tracking down memory leaks since the OS can track the number of allocations
from each pool and help to point us in the right direction. Also replace
drm_alloc and friends with static __inline__ versions while we are here.
Diffstat (limited to 'bsd-core/drm_sysctl.c')
-rw-r--r-- | bsd-core/drm_sysctl.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c index f9cfd9cf..f0227aa7 100644 --- a/bsd-core/drm_sysctl.c +++ b/bsd-core/drm_sysctl.c @@ -59,7 +59,7 @@ int drm_sysctl_init(struct drm_device *dev) struct sysctl_oid *top, *drioid; int i; - info = malloc(sizeof *info, M_DRM, M_WAITOK | M_ZERO); + info = malloc(sizeof *info, DRM_MEM_DRIVER, M_WAITOK | M_ZERO); if ( !info ) return 1; dev->sysctl = info; @@ -111,7 +111,7 @@ int drm_sysctl_cleanup(struct drm_device *dev) int error; error = sysctl_ctx_free( &dev->sysctl->ctx ); - free(dev->sysctl, M_DRM); + free(dev->sysctl, DRM_MEM_DRIVER); dev->sysctl = NULL; return error; @@ -169,7 +169,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS TAILQ_FOREACH(map, &dev->maplist, link) mapcount++; - tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, M_DRM, M_NOWAIT); + tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER, + M_NOWAIT); if (tempmaps == NULL) { DRM_UNLOCK(); return ENOMEM; @@ -205,7 +206,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS SYSCTL_OUT(req, "", 1); done: - free(tempmaps, M_DRM); + free(tempmaps, DRM_MEM_DRIVER); return retcode; } @@ -229,7 +230,8 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS } DRM_SPINLOCK(&dev->dma_lock); tempdma = *dma; - templists = malloc(sizeof(int) * dma->buf_count, M_DRM, M_NOWAIT); + templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER, + M_NOWAIT); for (i = 0; i < dma->buf_count; i++) templists[i] = dma->buflist[i]->list; dma = &tempdma; @@ -261,7 +263,7 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS SYSCTL_OUT(req, "", 1); done: - free(templists, M_DRM); + free(templists, DRM_MEM_DRIVER); return retcode; } @@ -279,7 +281,8 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS TAILQ_FOREACH(priv, &dev->files, link) privcount++; - tempprivs = malloc(sizeof(struct drm_file) * privcount, M_DRM, M_NOWAIT); + tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER, + M_NOWAIT); if (tempprivs == NULL) { DRM_UNLOCK(); return ENOMEM; @@ -304,6 +307,6 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS SYSCTL_OUT(req, "", 1); done: - free(tempprivs, M_DRM); + free(tempprivs, DRM_MEM_DRIVER); return retcode; } |