On Tue, Jul 08, 2014 at 03:26:36PM -0700, bradley.d.volkin@xxxxxxxxx wrote: > +void i915_gem_batch_pool_fini(struct i915_gem_batch_pool *pool) > +{ > + struct drm_i915_gem_object *obj, *next; > + > + WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex)); > + WARN_ON(!list_empty(&pool->active_list)); > + > + list_for_each_entry_safe(obj, next, > + &pool->inactive_list, batch_pool_list) { > + list_del(&obj->batch_pool_list); > + drm_gem_object_unreference(&obj->base); > + } Cleanup loops are idiomatically: while (!list_empty()) { } > +struct drm_i915_gem_object * > +i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool, > + size_t size) > +{ > + struct drm_i915_gem_object *obj = NULL; > + struct drm_i915_gem_object *tmp; > + > + WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex)); > + > + list_for_each_entry(tmp, &pool->inactive_list, batch_pool_list) { > + if (tmp->base.size >= size) { A general rule-of-thumb we use elsewhere is not to hand back an object that is greater than 2x the request. If you want to be generic, you could change size to min_size, max_size. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx