[2/2] drm/i915: Add rpm get/put in i915_shrinker_oom

Submitted by Mika Kuoppala on April 13, 2016, 1:54 p.m.

Details

Message ID 1460555647-32557-3-git-send-email-mika.kuoppala@intel.com
State New
Headers show
Series "ci-run of shrinker rpm fixes" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Mika Kuoppala April 13, 2016, 1:54 p.m.
From: Praveen Paneri <praveen.paneri@intel.com>

i915_gem_shrink_all() will scan the bound list only if device is not
suspended but in OOM scenarios it becomes absolutely necessary to
release as much memory as possible. So, adding rpm get/put in
i915_shrinker_oom() to ensure shrinking of bound objects in OOM
scenario.

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 | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index dff6596a680f..206736673a52 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -353,7 +353,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

Comments

On Wed, Apr 13, 2016 at 04:54:07PM +0300, Mika Kuoppala wrote:
> From: Praveen Paneri <praveen.paneri@intel.com>
> 
> i915_gem_shrink_all() will scan the bound list only if device is not
> suspended but in OOM scenarios it becomes absolutely necessary to
> release as much memory as possible. So, adding rpm get/put in
> i915_shrinker_oom() to ensure shrinking of bound objects in OOM
> scenario.
> 
> 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 | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> index dff6596a680f..206736673a52 100644
> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> @@ -353,7 +353,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);

Out of date, see also shrinker_vmap.
-Chris