diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-05-22 14:14:22 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-06-15 09:35:33 +1000 |
commit | e6c03c5b40314d787f7053f631594d6b1bd609e8 (patch) | |
tree | 78812c9e3bd28996817b5653e024915cb794b325 /drivers/gpu/drm | |
parent | 602c11a8ee62d49cddbc5972e5edb876dd415113 (diff) | |
download | linux-e6c03c5b40314d787f7053f631594d6b1bd609e8.tar.bz2 |
drm: Memory fragmentation from lost alignment blocks
If the block needs an alignment but otherwise fits exactly into the tail,
then the split-off block from the start would remain marked as non-free.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 7819fd930a51..a912a0ff11cc 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -188,36 +188,34 @@ static struct drm_mm_node *drm_mm_split_at_start(struct drm_mm_node *parent, -struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent, - unsigned long size, unsigned alignment) +struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *node, + unsigned long size, unsigned alignment) { struct drm_mm_node *align_splitoff = NULL; - struct drm_mm_node *child; unsigned tmp = 0; if (alignment) - tmp = parent->start % alignment; + tmp = node->start % alignment; if (tmp) { align_splitoff = - drm_mm_split_at_start(parent, alignment - tmp, 0); + drm_mm_split_at_start(node, alignment - tmp, 0); if (unlikely(align_splitoff == NULL)) return NULL; } - if (parent->size == size) { - list_del_init(&parent->fl_entry); - parent->free = 0; - return parent; + if (node->size == size) { + list_del_init(&node->fl_entry); + node->free = 0; } else { - child = drm_mm_split_at_start(parent, size, 0); + node = drm_mm_split_at_start(node, size, 0); } if (align_splitoff) drm_mm_put_block(align_splitoff); - return child; + return node; } EXPORT_SYMBOL(drm_mm_get_block); |