diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-05-21 09:21:28 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-05-24 15:04:16 +0100 |
commit | 2f7e87692e0441abf27a9714991edd136e87363a (patch) | |
tree | a985728198854faad96a6cabc37378fb1039317e /include/drm | |
parent | 1d1a4f6dd1645fba6533c7884582006d13664748 (diff) |
drm/mm: Reject over-sized allocation requests early
As we keep an rbtree of available holes sorted by their size, we can
very easily determine if there is any hole large enough that might
satisfy the allocation request. This helps when dealing with a highly
fragmented address space and a request for a search by address.
To cache the largest size, we convert into the cached rbtree variant
which tracks the leftmost node for us. However, currently we sorted into
ascending size order so the leftmost node is the smallest, and so to
make it the largest hole we need to invert our sorting.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180521082131.13744-1-chris@chris-wilson.co.uk
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drm_mm.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 101f566ae43d..e3aa3bfd4860 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -173,7 +173,7 @@ struct drm_mm { struct drm_mm_node head_node; /* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */ struct rb_root_cached interval_tree; - struct rb_root holes_size; + struct rb_root_cached holes_size; struct rb_root holes_addr; unsigned long scan_active; |