diff mbox

[2/2] drm/i915: Add rpm get/put in oom and vmap notifier

Message ID 1462178429-13449-2-git-send-email-praveen.paneri@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Praveen Paneri May 2, 2016, 8:40 a.m. UTC
i915_gem_shrink() will scan the bound list only if device is not
suspended but in OOM failure scenario it becomes absolutely necessary
to release as much memory as possible. Also in allocation failure from
vmap address space, it is incumbent on the Driver to reap all its
vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Chris Wilson May 2, 2016, 1:04 p.m. UTC | #1
On Mon, May 02, 2016 at 02:10:29PM +0530, Praveen Paneri wrote:
> i915_gem_shrink() will scan the bound list only if device is not
> suspended but in OOM failure scenario it becomes absolutely necessary
> to release as much memory as possible. Also in allocation failure from
> vmap address space, it is incumbent on the Driver to reap all its
> vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
> i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.
> 
> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Please do mention when you made changed. I skipped over this series when
I only saw the 2 patches because I thought to myself you hadn't added the
third patch for the new vmap path.

Nevertheless applied, thanks.
-Chris
Praveen Paneri May 3, 2016, 3:46 a.m. UTC | #2
On Monday 02 May 2016 06:34 PM, Chris Wilson wrote:
> On Mon, May 02, 2016 at 02:10:29PM +0530, Praveen Paneri wrote:
>> i915_gem_shrink() will scan the bound list only if device is not
>> suspended but in OOM failure scenario it becomes absolutely necessary
>> to release as much memory as possible. Also in allocation failure from
>> vmap address space, it is incumbent on the Driver to reap all its
>> vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
>> i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.
>>
>> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
>> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>
> Please do mention when you made changed. I skipped over this series when
> I only saw the 2 patches because I thought to myself you hadn't added the
> third patch for the new vmap path.
Will take care of this going forward.

Thanks,
Praveen
>
> Nevertheless applied, thanks.
> -Chris
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 9a24415..79004f3 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -357,7 +357,9 @@  i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
 	if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000))
 		return NOTIFY_DONE;
 
+	intel_runtime_pm_get(dev_priv);
 	freed_pages = i915_gem_shrink_all(dev_priv);
+	intel_runtime_pm_put(dev_priv);
 
 	/* Because we may be allocating inside our own driver, we cannot
 	 * assert that there are no objects with pinned pages that are not
@@ -410,11 +412,13 @@  i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
 	if (ret)
 		goto out;
 
+	intel_runtime_pm_get(dev_priv);
 	freed_pages += i915_gem_shrink(dev_priv, -1UL,
 				       I915_SHRINK_BOUND |
 				       I915_SHRINK_UNBOUND |
 				       I915_SHRINK_ACTIVE |
 				       I915_SHRINK_VMAPS);
+	intel_runtime_pm_put(dev_priv);
 
 	/* We also want to clear any cached iomaps as they wrap vmap */
 	list_for_each_entry_safe(vma, next,