[Intel-gfx] [PATCH v5] drm/i915/gtt: Avoid calling kcalloc in a loop when allocating temp bitmaps

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 3 13:48:03 PDT 2015


On Thu, Sep 03, 2015 at 07:22:18PM +0200, MichaƂ Winiarski wrote:
> +	pts = kcalloc(pdpes * BITS_TO_LONGS(I915_PDES),
> +		      sizeof(unsigned long), GFP_TEMPORARY);

Something to remember is that kcalloc is written presuming that the size
argument (the second) is constant.

pts = kcalloc(pdpes,
	      BITS_TO_LONGS(I915_PDES) * sizeof(unsigned long),
	      GFP_TEMPORARY);

should be infinitesimally more efficient.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list