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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 25 Sep 2023, Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> wrote:
> 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@xxxxxxxxx>
>> 
>> 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@xxxxxxxxx>
>> Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxxxx>
>> Reviewed-by: Andrzej Hajda <andrzej.hajda@xxxxxxxxx>
>
> [...]
>
>> -	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 :)

Always use int over unsigned int if you don't have a specific reason not
to. ("It can't be negative" is not a good reason.)

BR,
Jani.

>
> The rest looks good.
>
> Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> 
>
> Andi

-- 
Jani Nikula, Intel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux