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_scatter.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_scatter.c')
-rw-r--r-- | bsd-core/drm_scatter.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c index 550e6f88..7d47e605 100644 --- a/bsd-core/drm_scatter.c +++ b/bsd-core/drm_scatter.c @@ -40,9 +40,9 @@ void drm_sg_cleanup(drm_sg_mem_t *entry) { - free((void *)entry->handle, M_DRM); - free(entry->busaddr, M_DRM); - free(entry, M_DRM); + free((void *)entry->handle, DRM_MEM_PAGES); + free(entry->busaddr, DRM_MEM_PAGES); + free(entry, DRM_MEM_SGLISTS); } int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request) @@ -54,7 +54,7 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request) if (dev->sg) return EINVAL; - entry = malloc(sizeof(*entry), M_DRM, M_WAITOK | M_ZERO); + entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO); if (!entry) return ENOMEM; @@ -63,14 +63,14 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request) entry->pages = pages; - entry->busaddr = malloc(pages * sizeof(*entry->busaddr), M_DRM, + entry->busaddr = malloc(pages * sizeof(*entry->busaddr), DRM_MEM_PAGES, M_WAITOK | M_ZERO); if (!entry->busaddr) { drm_sg_cleanup(entry); return ENOMEM; } - entry->handle = (long)malloc(pages << PAGE_SHIFT, M_DRM, + entry->handle = (long)malloc(pages << PAGE_SHIFT, DRM_MEM_PAGES, M_WAITOK | M_ZERO); if (entry->handle == 0) { drm_sg_cleanup(entry); |