* [PATCH v2 1/3] drm/i915/shrinker: Only report objects with extra pinned pages as pinned @ 2016-04-20 11:09 Chris Wilson 2016-04-20 11:09 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson 2016-04-20 11:09 ` [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap Chris Wilson 0 siblings, 2 replies; 7+ messages in thread From: Chris Wilson @ 2016-04-20 11:09 UTC (permalink / raw) To: intel-gfx; +Cc: Akash Goel When iterating over the bound list, we expect all objects there to have their pages pinned (by the bound VMA). So only report those objects with additional pin count on their pages as "pinned". These should be those objects used for display and hardware access. Reported-by: Akash Goel <akash.goel@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Akash Goel <akash.goel@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index d46388f25e04..4e4fcfa76b4c 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -361,7 +361,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) if (!obj->base.filp) continue; - if (obj->pages_pin_count) + if (obj->pages_pin_count > num_vma_bound(obj)) pinned += obj->base.size; else bound += obj->base.size; -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages 2016-04-20 11:09 [PATCH v2 1/3] drm/i915/shrinker: Only report objects with extra pinned pages as pinned Chris Wilson @ 2016-04-20 11:09 ` Chris Wilson 2016-04-20 11:51 ` Mika Kuoppala 2016-04-20 11:09 ` [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap Chris Wilson 1 sibling, 1 reply; 7+ messages in thread From: Chris Wilson @ 2016-04-20 11:09 UTC (permalink / raw) To: intel-gfx Inside the shrinker we call can_release_pages() to indicate whether or not we can make forward progress in freeing up memory by unbinding that object. When adding our report to oom, we should be using the same logic. Whilst here, change the reporting from bytes to pages so that it looks smaller to the user!, is consistent with the neighbouring oom report itself which displays counts in pages, and makes the unsigned long overflow less likely. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index 4e4fcfa76b4c..cb225e039d48 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -336,7 +336,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) container_of(nb, struct drm_i915_private, mm.oom_notifier); struct shrinker_lock_uninterruptible slu; struct drm_i915_gem_object *obj; - unsigned long pinned, bound, unbound, freed_pages; + unsigned long unevictable, bound, unbound, freed_pages; if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000)) return NOTIFY_DONE; @@ -347,33 +347,33 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) * assert that there are no objects with pinned pages that are not * being pointed to by hardware. */ - unbound = bound = pinned = 0; + unbound = bound = unevictable = 0; list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { if (!obj->base.filp) /* not backed by a freeable object */ continue; - if (obj->pages_pin_count) - pinned += obj->base.size; + if (!can_release_pages(obj)) + unevictable += obj->base.size >> PAGE_SHIFT; else - unbound += obj->base.size; + unbound += obj->base.size >> PAGE_SHIFT; } list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { if (!obj->base.filp) continue; - if (obj->pages_pin_count > num_vma_bound(obj)) - pinned += obj->base.size; + if (!can_release_pages(obj)) + unevictable += obj->base.size >> PAGE_SHIFT; else - bound += obj->base.size; + bound += obj->base.size >> PAGE_SHIFT; } i915_gem_shrinker_unlock_uninterruptible(dev_priv, &slu); if (freed_pages || unbound || bound) - pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n", - freed_pages << PAGE_SHIFT, pinned); + pr_info("Purging GPU memory, %lu pages freed, %lu pages still pinned.\n", + freed_pages, unevictable); if (unbound || bound) - pr_err("%lu and %lu bytes still available in the " + pr_err("%lu and %lu pages still available in the " "bound and unbound GPU page lists.\n", bound, unbound); -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages 2016-04-20 11:09 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson @ 2016-04-20 11:51 ` Mika Kuoppala 0 siblings, 0 replies; 7+ messages in thread From: Mika Kuoppala @ 2016-04-20 11:51 UTC (permalink / raw) To: Chris Wilson, intel-gfx Chris Wilson <chris@chris-wilson.co.uk> writes: > [ text/plain ] > Inside the shrinker we call can_release_pages() to indicate whether or > not we can make forward progress in freeing up memory by unbinding that > object. When adding our report to oom, we should be using the same > logic. > > Whilst here, change the reporting from bytes to pages so that it looks > smaller to the user!, is consistent with the neighbouring oom report > itself which displays counts in pages, and makes the unsigned long > overflow less likely. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> > --- > drivers/gpu/drm/i915/i915_gem_shrinker.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c > index 4e4fcfa76b4c..cb225e039d48 100644 > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c > @@ -336,7 +336,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > container_of(nb, struct drm_i915_private, mm.oom_notifier); > struct shrinker_lock_uninterruptible slu; > struct drm_i915_gem_object *obj; > - unsigned long pinned, bound, unbound, freed_pages; > + unsigned long unevictable, bound, unbound, freed_pages; > > if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000)) > return NOTIFY_DONE; > @@ -347,33 +347,33 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > * assert that there are no objects with pinned pages that are not > * being pointed to by hardware. > */ > - unbound = bound = pinned = 0; > + unbound = bound = unevictable = 0; > list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { > if (!obj->base.filp) /* not backed by a freeable object */ > continue; > > - if (obj->pages_pin_count) > - pinned += obj->base.size; > + if (!can_release_pages(obj)) > + unevictable += obj->base.size >> PAGE_SHIFT; > else > - unbound += obj->base.size; > + unbound += obj->base.size >> PAGE_SHIFT; > } > list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { > if (!obj->base.filp) > continue; > > - if (obj->pages_pin_count > num_vma_bound(obj)) > - pinned += obj->base.size; > + if (!can_release_pages(obj)) > + unevictable += obj->base.size >> PAGE_SHIFT; > else > - bound += obj->base.size; > + bound += obj->base.size >> PAGE_SHIFT; > } > > i915_gem_shrinker_unlock_uninterruptible(dev_priv, &slu); > > if (freed_pages || unbound || bound) > - pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n", > - freed_pages << PAGE_SHIFT, pinned); > + pr_info("Purging GPU memory, %lu pages freed, %lu pages still pinned.\n", > + freed_pages, unevictable); > if (unbound || bound) > - pr_err("%lu and %lu bytes still available in the " > + pr_err("%lu and %lu pages still available in the " > "bound and unbound GPU page lists.\n", > bound, unbound); > > -- > 2.8.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap 2016-04-20 11:09 [PATCH v2 1/3] drm/i915/shrinker: Only report objects with extra pinned pages as pinned Chris Wilson 2016-04-20 11:09 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson @ 2016-04-20 11:09 ` Chris Wilson 2016-04-20 11:54 ` Mika Kuoppala 1 sibling, 1 reply; 7+ messages in thread From: Chris Wilson @ 2016-04-20 11:09 UTC (permalink / raw) To: intel-gfx Since we can only swap out shmemfs objects, those are the only ones that influence the ability of the shrinker to can free pages. Currently, all non-shmemfs objects have a raised pages_pin_count to protect them from the shrinker, so this just makes the logic for can_release_pages() clearer (and safer in future so that we don't over estimate our ability to free up pages from future non-swappable objects). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index cb225e039d48..e44c6358bd5a 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -70,6 +70,10 @@ static bool swap_available(void) static bool can_release_pages(struct drm_i915_gem_object *obj) { + /* Only shmemfs objects are backed by swapped */ + if (!obj->base.filp) + return false; + /* Only report true if by unbinding the object and putting its pages * we can actually make forward progress towards freeing physical * pages. @@ -349,18 +353,12 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) */ unbound = bound = unevictable = 0; list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { - if (!obj->base.filp) /* not backed by a freeable object */ - continue; - if (!can_release_pages(obj)) unevictable += obj->base.size >> PAGE_SHIFT; else unbound += obj->base.size >> PAGE_SHIFT; } list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { - if (!obj->base.filp) - continue; - if (!can_release_pages(obj)) unevictable += obj->base.size >> PAGE_SHIFT; else -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap 2016-04-20 11:09 ` [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap Chris Wilson @ 2016-04-20 11:54 ` Mika Kuoppala 0 siblings, 0 replies; 7+ messages in thread From: Mika Kuoppala @ 2016-04-20 11:54 UTC (permalink / raw) To: Chris Wilson, intel-gfx Chris Wilson <chris@chris-wilson.co.uk> writes: > [ text/plain ] > Since we can only swap out shmemfs objects, those are the only ones that > influence the ability of the shrinker to can free pages. Currently, all > non-shmemfs objects have a raised pages_pin_count to protect them from > the shrinker, so this just makes the logic for can_release_pages() > clearer (and safer in future so that we don't over estimate our ability > to free up pages from future non-swappable objects). > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> > --- > drivers/gpu/drm/i915/i915_gem_shrinker.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c > index cb225e039d48..e44c6358bd5a 100644 > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c > @@ -70,6 +70,10 @@ static bool swap_available(void) > > static bool can_release_pages(struct drm_i915_gem_object *obj) > { > + /* Only shmemfs objects are backed by swapped */ > + if (!obj->base.filp) > + return false; > + > /* Only report true if by unbinding the object and putting its pages > * we can actually make forward progress towards freeing physical > * pages. > @@ -349,18 +353,12 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > */ > unbound = bound = unevictable = 0; > list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { > - if (!obj->base.filp) /* not backed by a freeable object */ > - continue; > - > if (!can_release_pages(obj)) > unevictable += obj->base.size >> PAGE_SHIFT; > else > unbound += obj->base.size >> PAGE_SHIFT; > } > list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { > - if (!obj->base.filp) > - continue; > - > if (!can_release_pages(obj)) > unevictable += obj->base.size >> PAGE_SHIFT; > else > -- > 2.8.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915/shrinker: Only report objects with extra pinned pages as pinned @ 2016-04-20 8:56 Joonas Lahtinen 2016-04-20 11:04 ` [PATCH v2 1/3] " Chris Wilson 0 siblings, 1 reply; 7+ messages in thread From: Joonas Lahtinen @ 2016-04-20 8:56 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: Akash Goel On ke, 2016-04-20 at 08:43 +0100, Chris Wilson wrote: > When iterating over the bound list, we expect all objects there to have > their pages pinned (by the bound VMA). So only add those objects with > additional pin count on their pages as "pinned". These should be those > objects used for display and hardware access. > > Reported-by: Akash Goel <akash.goel@intel.com> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Akash Goel <akash.goel@intel.com> > --- > drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c > index d46388f25e04..4e4fcfa76b4c 100644 > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c > @@ -361,7 +361,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > if (!obj->base.filp) > continue; > > - if (obj->pages_pin_count) > + if (obj->pages_pin_count > num_vma_bound(obj)) > pinned += obj->base.size; > else > bound += obj->base.size; -- Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] drm/i915/shrinker: Only report objects with extra pinned pages as pinned 2016-04-20 8:56 [PATCH] drm/i915/shrinker: Only report objects with extra pinned pages as pinned Joonas Lahtinen @ 2016-04-20 11:04 ` Chris Wilson 2016-04-20 11:04 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson 0 siblings, 1 reply; 7+ messages in thread From: Chris Wilson @ 2016-04-20 11:04 UTC (permalink / raw) To: intel-gfx; +Cc: Akash Goel When iterating over the bound list, we expect all objects there to have their pages pinned (by the bound VMA). So only report those objects with additional pin count on their pages as "pinned". These should be those objects used for display and hardware access. Reported-by: Akash Goel <akash.goel@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Akash Goel <akash.goel@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index d46388f25e04..4e4fcfa76b4c 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -361,7 +361,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) if (!obj->base.filp) continue; - if (obj->pages_pin_count) + if (obj->pages_pin_count > num_vma_bound(obj)) pinned += obj->base.size; else bound += obj->base.size; -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages 2016-04-20 11:04 ` [PATCH v2 1/3] " Chris Wilson @ 2016-04-20 11:04 ` Chris Wilson 2016-04-20 12:02 ` Joonas Lahtinen 0 siblings, 1 reply; 7+ messages in thread From: Chris Wilson @ 2016-04-20 11:04 UTC (permalink / raw) To: intel-gfx Inside the shrinker we call can_release_pages() to indicate whether or not we can make forward progress in freeing up memory by unbinding that object. When adding our report to oom, we should be using the same logic. Whilst here, change the reporting from bytes to pages so that it looks smaller to the user!, is consistent with the neighbouring oom report itself which displays counts in pages, and makes the unsigned long overflow less likely. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index 4e4fcfa76b4c..cb225e039d48 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -336,7 +336,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) container_of(nb, struct drm_i915_private, mm.oom_notifier); struct shrinker_lock_uninterruptible slu; struct drm_i915_gem_object *obj; - unsigned long pinned, bound, unbound, freed_pages; + unsigned long unevictable, bound, unbound, freed_pages; if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000)) return NOTIFY_DONE; @@ -347,33 +347,33 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) * assert that there are no objects with pinned pages that are not * being pointed to by hardware. */ - unbound = bound = pinned = 0; + unbound = bound = unevictable = 0; list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { if (!obj->base.filp) /* not backed by a freeable object */ continue; - if (obj->pages_pin_count) - pinned += obj->base.size; + if (!can_release_pages(obj)) + unevictable += obj->base.size >> PAGE_SHIFT; else - unbound += obj->base.size; + unbound += obj->base.size >> PAGE_SHIFT; } list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { if (!obj->base.filp) continue; - if (obj->pages_pin_count > num_vma_bound(obj)) - pinned += obj->base.size; + if (!can_release_pages(obj)) + unevictable += obj->base.size >> PAGE_SHIFT; else - bound += obj->base.size; + bound += obj->base.size >> PAGE_SHIFT; } i915_gem_shrinker_unlock_uninterruptible(dev_priv, &slu); if (freed_pages || unbound || bound) - pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n", - freed_pages << PAGE_SHIFT, pinned); + pr_info("Purging GPU memory, %lu pages freed, %lu pages still pinned.\n", + freed_pages, unevictable); if (unbound || bound) - pr_err("%lu and %lu bytes still available in the " + pr_err("%lu and %lu pages still available in the " "bound and unbound GPU page lists.\n", bound, unbound); -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages 2016-04-20 11:04 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson @ 2016-04-20 12:02 ` Joonas Lahtinen 0 siblings, 0 replies; 7+ messages in thread From: Joonas Lahtinen @ 2016-04-20 12:02 UTC (permalink / raw) To: Chris Wilson, intel-gfx On ke, 2016-04-20 at 12:04 +0100, Chris Wilson wrote: > Inside the shrinker we call can_release_pages() to indicate whether or > not we can make forward progress in freeing up memory by unbinding that > object. When adding our report to oom, we should be using the same > logic. > > Whilst here, change the reporting from bytes to pages so that it looks > smaller to the user!, is consistent with the neighbouring oom report > itself which displays counts in pages, and makes the unsigned long > overflow less likely. Makes sense as that is the smallest pinning unit, too. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_gem_shrinker.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c > index 4e4fcfa76b4c..cb225e039d48 100644 > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c > @@ -336,7 +336,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > container_of(nb, struct drm_i915_private, mm.oom_notifier); > struct shrinker_lock_uninterruptible slu; > struct drm_i915_gem_object *obj; > - unsigned long pinned, bound, unbound, freed_pages; > + unsigned long unevictable, bound, unbound, freed_pages; > > if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000)) > return NOTIFY_DONE; > @@ -347,33 +347,33 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr) > * assert that there are no objects with pinned pages that are not > * being pointed to by hardware. > */ > - unbound = bound = pinned = 0; > + unbound = bound = unevictable = 0; > list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { > if (!obj->base.filp) /* not backed by a freeable object */ > continue; > > - if (obj->pages_pin_count) > - pinned += obj->base.size; > + if (!can_release_pages(obj)) > + unevictable += obj->base.size >> PAGE_SHIFT; > else > - unbound += obj->base.size; > + unbound += obj->base.size >> PAGE_SHIFT; > } > list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { > if (!obj->base.filp) > continue; > > - if (obj->pages_pin_count > num_vma_bound(obj)) > - pinned += obj->base.size; > + if (!can_release_pages(obj)) > + unevictable += obj->base.size >> PAGE_SHIFT; > else > - bound += obj->base.size; > + bound += obj->base.size >> PAGE_SHIFT; > } > > i915_gem_shrinker_unlock_uninterruptible(dev_priv, &slu); > > if (freed_pages || unbound || bound) > - pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n", > - freed_pages << PAGE_SHIFT, pinned); > + pr_info("Purging GPU memory, %lu pages freed, %lu pages still pinned.\n", > + freed_pages, unevictable); My code checker senses are tingling, this looks very much like oversized line, mind cutting it down? With that addressed, Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > if (unbound || bound) > - pr_err("%lu and %lu bytes still available in the " > + pr_err("%lu and %lu pages still available in the " > "bound and unbound GPU page lists.\n", > bound, unbound); > -- Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-20 12:01 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-04-20 11:09 [PATCH v2 1/3] drm/i915/shrinker: Only report objects with extra pinned pages as pinned Chris Wilson 2016-04-20 11:09 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson 2016-04-20 11:51 ` Mika Kuoppala 2016-04-20 11:09 ` [PATCH v2 3/3] drm/i915/shrinker: Only shmemfs objects are backed by swap Chris Wilson 2016-04-20 11:54 ` Mika Kuoppala -- strict thread matches above, loose matches on Subject: below -- 2016-04-20 8:56 [PATCH] drm/i915/shrinker: Only report objects with extra pinned pages as pinned Joonas Lahtinen 2016-04-20 11:04 ` [PATCH v2 1/3] " Chris Wilson 2016-04-20 11:04 ` [PATCH v2 2/3] drm/i915/shrinker: Report "unevictable" pages Chris Wilson 2016-04-20 12:02 ` Joonas Lahtinen
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.