[Intel-gfx] [RFC] drm/i915/sw_fence: Allocate callbacks from dedicates slab caches

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 2 17:58:42 UTC 2016


On Wed, Nov 02, 2016 at 05:44:07PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Not sure if it matters for performance at all but it should
> save some wastage and enable a better insight into the usage.

With the caveat of avoiding the plug into the i915.ko...

This should wait until after kernel/fence.c, as the split will make this
a little more interesting.

> +int i915_init_sw_fences(void)
> +{
> +	struct kmem_cache *wq_cache, *cb_cache;
> +
> +	mutex_lock(&i915_sw_fence_mutex);

If switched over to init ctor, the mutex is then redundant.

> +	if (i915_sw_fence_usecnt == 0) {
> +		wq_cache = kmem_cache_create("i915_sw_fence_wq",
> +					     sizeof(wait_queue_t),
> +					     __alignof__(wait_queue_head_t),
> +					     0, NULL);
> +		if (!wq_cache)
> +			goto err;
> +
> +		cb_cache = kmem_cache_create("i915_sw_fence_cb",
> +					     sizeof(struct i915_sw_dma_fence_cb),
> +					     __alignof__(struct i915_sw_dma_fence_cb),
> +					     0, NULL);

For example, this cache will need to end up in
drivers/dma-buf/dma-fence.c
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list