Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Mika Kuoppala <mika.kuoppala@intel.com>,
	stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Allow shrinking of userptr objects once again
Date: Tue, 1 Nov 2016 14:29:39 +0000	[thread overview]
Message-ID: <f2b61599-0393-a7e3-935c-d3b0c1d08e1e@linux.intel.com> (raw)
In-Reply-To: <20161101135250.GA26576@nuc-i3427.alporthouse.com>


On 01/11/2016 13:52, Chris Wilson wrote:
> On Tue, Nov 01, 2016 at 01:28:06PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Commit 1bec9b0bda3d ("drm/i915/shrinker: Only shmemfs objects
>> are backed by swap") stopped considering the userptr objects
>> in shrinker callbacks.
>>
>> Restore that so idle userptr objects can be discarded in order
>> to free up memory.
>>
>> One change further to what was introduced in 1bec9b0bda3d is
>> to start considering userptr objects in oom but that should
>> also be a correct thing to do.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Fixes: 1bec9b0bda3d ("drm/i915/shrinker: Only shmemfs objects are backed by swap")
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>> Cc: <stable@vger.kernel.org>
>> ---
>>  drivers/gpu/drm/i915/i915_gem_shrinker.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> index 0993afc0e725..dfca1f6b3630 100644
>> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
>> @@ -83,8 +83,8 @@ static bool can_release_pages(struct drm_i915_gem_object *obj)
>>  	if (!obj->mm.pages)
>>  		return false;
>>
>> -	/* Only shmemfs objects are backed by swap */
>> -	if (!obj->base.filp)
>> +	/* shmemfs and userptr objects are backed by swap */
>> +	if (!obj->base.filp && !obj->userptr.mm)
>
> Hmm. Another sticking point if we want to use the union again.
>
> How about obj->ops->flags & I915_GEM_OBJECT_HAS_BACKING_STORE ?
> Or I915_GEM_OBJECT_CAN_SWAP since we want this for i915_gem_internal.c
> as well, and that techinically doesn't have a backing store but can be
> reaped. Hmm.
>
> if (!(obj->ops->flags & I915_GEM_OBJECT_HAS_BACKING_STORE ||
>       obj->mm.madv == I915_MADV_DONTNEED))

Hm I915_GEM_OBJECT_HAS_STRUCT_PAGE happens to be right - shm, userptr 
and internal. But that would be bad. Neither do I like HAS_BACKING_STORE.

Maybe I915_GEM_OBJECT_IS_SHRINKABLE, fully dumb and explicit?

Regards,

Tvrtko

  reply	other threads:[~2016-11-01 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 13:28 [PATCH] drm/i915: Allow shrinking of userptr objects once again Tvrtko Ursulin
2016-11-01 13:52 ` Chris Wilson
2016-11-01 14:29   ` Tvrtko Ursulin [this message]
2016-11-01 14:34     ` [Intel-gfx] " Chris Wilson
2016-11-01 14:44       ` [PATCH v2] " Tvrtko Ursulin
2016-11-01 15:05         ` Chris Wilson

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=f2b61599-0393-a7e3-935c-d3b0c1d08e1e@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=mika.kuoppala@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tursulin@ursulin.net \
    --cc=tvrtko.ursulin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox