From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx165.postini.com [74.125.245.165]) by kanga.kvack.org (Postfix) with SMTP id 7064F6B0071 for ; Mon, 3 Jun 2013 15:36:08 -0400 (EDT) From: Glauber Costa Subject: [PATCH v10 21/35] i915: bail out earlier when shrinker cannot acquire mutex Date: Mon, 3 Jun 2013 23:29:50 +0400 Message-Id: <1370287804-3481-22-git-send-email-glommer@openvz.org> In-Reply-To: <1370287804-3481-1-git-send-email-glommer@openvz.org> References: <1370287804-3481-1-git-send-email-glommer@openvz.org> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: linux-fsdevel@vger.kernel.org, Mel Gorman , Dave Chinner , linux-mm@kvack.org, cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, Michal Hocko , Johannes Weiner , hughd@google.com, Greg Thelen , Glauber Costa , Dave Chinner , Kent Overstreet The main shrinker driver will keep trying for a while to free objects if the returned value from the shrink scan procedure is 0. That means "no objects now", but a retry could very well succeed. A negative value has a different meaning. It means it is impossible to shrink, and we would better bail out soon. We find this behavior more appropriate for the case where the lock cannot be taken. Specially given the hammer behavior of the i915: if another thread is already shrinking, we are likely not to be able to shrink anything anyway when we finally acquire the mutex. Signed-off-by: Glauber Costa Acked-by: Daniel Vetter CC: Dave Chinner CC: Mel Gorman CC: Kent Overstreet --- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index e360031..72a05ee 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4490,10 +4490,10 @@ i915_gem_inactive_count(struct shrinker *shrinker, struct shrink_control *sc) if (!mutex_trylock(&dev->struct_mutex)) { if (!mutex_is_locked_by(&dev->struct_mutex, current)) - return 0; + return -1; if (dev_priv->mm.shrinker_no_lock_stealing) - return 0; + return -1; unlock = false; } -- 1.8.1.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org