Commit 005445c5 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Report the current number of bytes freed during oom

The shrinker reports the number of pages freed, but we try to log the
number of bytes - which leads to some nonsense values being reportedly
freed during oom.
Reported-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 43dc52c3
...@@ -5259,7 +5259,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) ...@@ -5259,7 +5259,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
unsigned long timeout = msecs_to_jiffies(5000) + 1; unsigned long timeout = msecs_to_jiffies(5000) + 1;
unsigned long pinned, bound, unbound, freed; unsigned long pinned, bound, unbound, freed_pages;
bool was_interruptible; bool was_interruptible;
bool unlock; bool unlock;
...@@ -5276,7 +5276,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) ...@@ -5276,7 +5276,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
was_interruptible = dev_priv->mm.interruptible; was_interruptible = dev_priv->mm.interruptible;
dev_priv->mm.interruptible = false; dev_priv->mm.interruptible = false;
freed = i915_gem_shrink_all(dev_priv); freed_pages = i915_gem_shrink_all(dev_priv);
dev_priv->mm.interruptible = was_interruptible; dev_priv->mm.interruptible = was_interruptible;
...@@ -5308,13 +5308,13 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) ...@@ -5308,13 +5308,13 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n", pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n",
freed, pinned); freed_pages << PAGE_SHIFT, pinned);
if (unbound || bound) if (unbound || bound)
pr_err("%lu and %lu bytes still available in the " pr_err("%lu and %lu bytes still available in the "
"bound and unbound GPU page lists.\n", "bound and unbound GPU page lists.\n",
bound, unbound); bound, unbound);
*(unsigned long *)ptr += freed; *(unsigned long *)ptr += freed_pages;
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment