On Thu, Oct 30, 2014 at 4:36 AM, Michel Dänzer <michel@xxxxxxxxxxx> wrote: > From: Michel Dänzer <michel.daenzer@xxxxxxx> > > In the words of Daniel Vetter: > > «I think SEARCH_BEST is pretty much always a bad idea - it rips apart > allocations from the same execbuf, and usually those get recycled around > the same time. Which means you'll just fragment your mm even more if you > try to find the best hole instead of just picking one and the stuffing > the entire execbuf into it. So imo we might as well just kill it.» > > Signed-off-by: Michel Dänzer <michel.daenzer@xxxxxxx> Applied this series to my -next tree. Thanks, Alex > --- > > This patch replaces the previous patches 4 and 5. > > Not sure about the function header comment hunk, maybe what it says is > true even with DRM_MM_SEARCH_BELOW? > > drivers/gpu/drm/drm_mm.c | 36 +++++------------------------------- > drivers/gpu/drm/ttm/ttm_bo_manager.c | 2 +- > include/drm/drm_mm.h | 3 +-- > 3 files changed, 7 insertions(+), 34 deletions(-) > > diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c > index 04a209e..3e0ef8c 100644 > --- a/drivers/gpu/drm/drm_mm.c > +++ b/drivers/gpu/drm/drm_mm.c > @@ -409,16 +409,11 @@ static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, > enum drm_mm_search_flags flags) > { > struct drm_mm_node *entry; > - struct drm_mm_node *best; > unsigned long adj_start; > unsigned long adj_end; > - unsigned long best_size; > > BUG_ON(mm->scanned_blocks); > > - best = NULL; > - best_size = ~0UL; > - > __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, > flags & DRM_MM_SEARCH_BELOW) { > unsigned long hole_size = adj_end - adj_start; > @@ -429,19 +424,11 @@ static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, > continue; > } > > - if (!check_free_hole(adj_start, adj_end, size, alignment)) > - continue; > - > - if (!(flags & DRM_MM_SEARCH_BEST)) > + if (check_free_hole(adj_start, adj_end, size, alignment)) > return entry; > - > - if (hole_size < best_size) { > - best = entry; > - best_size = hole_size; > - } > } > > - return best; > + return NULL; > } > > static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm, > @@ -453,16 +440,11 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_ > enum drm_mm_search_flags flags) > { > struct drm_mm_node *entry; > - struct drm_mm_node *best; > unsigned long adj_start; > unsigned long adj_end; > - unsigned long best_size; > > BUG_ON(mm->scanned_blocks); > > - best = NULL; > - best_size = ~0UL; > - > __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, > flags & DRM_MM_SEARCH_BELOW) { > unsigned long hole_size = adj_end - adj_start; > @@ -478,19 +460,11 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_ > continue; > } > > - if (!check_free_hole(adj_start, adj_end, size, alignment)) > - continue; > - > - if (!(flags & DRM_MM_SEARCH_BEST)) > + if (check_free_hole(adj_start, adj_end, size, alignment)) > return entry; > - > - if (hole_size < best_size) { > - best = entry; > - best_size = hole_size; > - } > } > > - return best; > + return NULL; > } > > /** > @@ -679,7 +653,7 @@ EXPORT_SYMBOL(drm_mm_scan_add_block); > * corrupted. > * > * When the scan list is empty, the selected memory nodes can be freed. An > - * immediately following drm_mm_search_free with !DRM_MM_SEARCH_BEST will then > + * immediately following drm_mm_search_free with !DRM_MM_SEARCH_BELOW will then > * return the just freed block (because its at the top of the free_stack list). > * > * Returns: > diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c > index aa0bd05..42c2aa9 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c > @@ -55,7 +55,7 @@ static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man, > struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; > struct drm_mm *mm = &rman->mm; > struct drm_mm_node *node = NULL; > - enum drm_mm_search_flags sflags = DRM_MM_SEARCH_BEST; > + enum drm_mm_search_flags sflags = DRM_MM_SEARCH_DEFAULT; > enum drm_mm_allocator_flags aflags = DRM_MM_CREATE_DEFAULT; > unsigned long lpfn; > int ret; > diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h > index a24addf..f38f7a0 100644 > --- a/include/drm/drm_mm.h > +++ b/include/drm/drm_mm.h > @@ -46,8 +46,7 @@ > > enum drm_mm_search_flags { > DRM_MM_SEARCH_DEFAULT = 0, > - DRM_MM_SEARCH_BEST = 1 << 0, > - DRM_MM_SEARCH_BELOW = 1 << 1, > + DRM_MM_SEARCH_BELOW = 1 << 0, > }; > > enum drm_mm_allocator_flags { > -- > 2.1.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel