[PATCH] drm/i915/gem: Make i915_gem_shrinker multi-gt aware

Andi Shyti andi.shyti at linux.intel.com
Mon Sep 25 14:46:54 UTC 2023


Hi Nirmoy,

you forgot the v2 here.

On Mon, Sep 25, 2023 at 03:49:38PM +0200, Nirmoy Das wrote:
> From: Jonathan Cavitt <jonathan.cavitt at intel.com>
> 
> Where applicable, use for_each_gt instead of to_gt in the
> i915_gem_shrinker functions to make them apply to more than just the
> primary GT.  Specifically, this ensure i915_gem_shrink_all retires all
> requests across all GTs, and this makes i915_gem_shrinker_vmap unmap
> VMAs from all GTs.
> 
> v2: Pass correct GT to intel_gt_retire_requests(Andrzej).
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>

[...]

> -	if (shrink & I915_SHRINK_ACTIVE)
> -		/* Retire requests to unpin all idle contexts */
> -		intel_gt_retire_requests(to_gt(i915));
> +	if (shrink & I915_SHRINK_ACTIVE) {
> +		for_each_gt(gt, i915, i)
> +			/* Retire requests to unpin all idle contexts */
> +			intel_gt_retire_requests(gt);
> +	}

These two brackets are not needed.

>  
>  	/*
>  	 * As we may completely rewrite the (un)bound list whilst unbinding
> @@ -389,6 +393,8 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
>  	struct i915_vma *vma, *next;
>  	unsigned long freed_pages = 0;
>  	intel_wakeref_t wakeref;
> +	struct intel_gt *gt;
> +	int i;

the trend is to use 'unsigned int' here and I've seen it
reviewed. Personally, if I really have to express a preference, I
prefer 'int' because it's a bit safer, generally I don't really
mind :)

The rest looks good.

Reviewed-by: Andi Shyti <andi.shyti at linux.intel.com> 

Andi


More information about the dri-devel mailing list