Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Fix up usage of SHRINK_STOP

In

commit 81e49f811404f428a9d9a63295a0c267e802fa12
Author: Glauber Costa <glommer@openvz.org>
Date: Wed Aug 28 10:18:13 2013 +1000

i915: bail out earlier when shrinker cannot acquire mutex

SHRINK_STOP was added to tell the core shrinker code to bail out and
go to the next shrinker since the i915 shrinker couldn't acquire
required locks. But the SHRINK_STOP return code was added to the
->count_objects callback and not the ->scan_objects callback as it
should have been, resulting in tons of dmesg noise like

shrink_slab: i915_gem_inactive_scan+0x0/0x9c negative objects to delete nr=-xxxxxxxxx

Fix discusssed with Dave Chinner.

References: http://www.spinics.net/lists/intel-gfx/msg33597.html
Reported-by: Knut Petersen <Knut_Petersen@t-online.de>
Cc: Knut Petersen <Knut_Petersen@t-online.de>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Glauber Costa <glommer@openvz.org>
Cc: Glauber Costa <glommer@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+4 -4
+4 -4
drivers/gpu/drm/i915/i915_gem.c
··· 4800 4800 4801 4801 if (!mutex_trylock(&dev->struct_mutex)) { 4802 4802 if (!mutex_is_locked_by(&dev->struct_mutex, current)) 4803 - return SHRINK_STOP; 4803 + return 0; 4804 4804 4805 4805 if (dev_priv->mm.shrinker_no_lock_stealing) 4806 - return SHRINK_STOP; 4806 + return 0; 4807 4807 4808 4808 unlock = false; 4809 4809 } ··· 4901 4901 4902 4902 if (!mutex_trylock(&dev->struct_mutex)) { 4903 4903 if (!mutex_is_locked_by(&dev->struct_mutex, current)) 4904 - return 0; 4904 + return SHRINK_STOP; 4905 4905 4906 4906 if (dev_priv->mm.shrinker_no_lock_stealing) 4907 - return 0; 4907 + return SHRINK_STOP; 4908 4908 4909 4909 unlock = false; 4910 4910 }