All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>,
	Nirmoy Das <nirmoy.das@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Jonathan Cavitt <jonathan.cavitt@intel.com>,
	dri-devel@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: Make i915_gem_shrinker multi-gt aware
Date: Mon, 25 Sep 2023 18:20:54 +0300	[thread overview]
Message-ID: <877coemg89.fsf@intel.com> (raw)
In-Reply-To: <ZRGdXq1WOWpx271q@ashyti-mobl2.lan>

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

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@linux.intel.com> 
>
> Andi

-- 
Jani Nikula, Intel

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>,
	Nirmoy Das <nirmoy.das@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Jonathan Cavitt <jonathan.cavitt@intel.com>,
	dri-devel@lists.freedesktop.org, andi.shyti@linux.intel.com,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [PATCH] drm/i915/gem: Make i915_gem_shrinker multi-gt aware
Date: Mon, 25 Sep 2023 18:20:54 +0300	[thread overview]
Message-ID: <877coemg89.fsf@intel.com> (raw)
In-Reply-To: <ZRGdXq1WOWpx271q@ashyti-mobl2.lan>

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

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@linux.intel.com> 
>
> Andi

-- 
Jani Nikula, Intel

  reply	other threads:[~2023-09-25 15:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 13:49 [Intel-gfx] [PATCH] drm/i915/gem: Make i915_gem_shrinker multi-gt aware Nirmoy Das
2023-09-25 13:49 ` Nirmoy Das
2023-09-25 14:46 ` [Intel-gfx] " Andi Shyti
2023-09-25 14:46   ` Andi Shyti
2023-09-25 15:20   ` Jani Nikula [this message]
2023-09-25 15:20     ` Jani Nikula
2023-09-25 15:24     ` [Intel-gfx] " Andi Shyti
2023-09-25 15:24       ` Andi Shyti
  -- strict thread matches above, loose matches on Subject: below --
2023-09-22 12:35 [Intel-gfx] " Nirmoy Das
2023-09-25 13:23 ` Andrzej Hajda
2023-09-25 13:32   ` Nirmoy Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877coemg89.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=nirmoy.das@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.