From patchwork Fri Jun 24 08:03:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Motohiro KOSAKI X-Patchwork-Id: 916392 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5OEPxmX003442 for ; Fri, 24 Jun 2011 14:26:20 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 99841A0ABC for ; Fri, 24 Jun 2011 07:25:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 24 Jun 2011 14:26:20 +0000 (UTC) X-Greylist: delayed 3655 seconds by postgrey-1.31 at gabe; Fri, 24 Jun 2011 02:04:32 PDT Received: from fgwmail7.fujitsu.co.jp (fgwmail7.fujitsu.co.jp [192.51.44.37]) by gabe.freedesktop.org (Postfix) with ESMTP id EBED29E793 for ; Fri, 24 Jun 2011 02:04:32 -0700 (PDT) Received: from fgwmail6.fujitsu.co.jp (fgwmail6.fujitsu.co.jp [192.51.44.36]) by fgwmail7.fujitsu.co.jp (Postfix) with ESMTP id 044441795D4A for ; Fri, 24 Jun 2011 17:03:38 +0900 (JST) Received: from m2.gw.fujitsu.co.jp (unknown [10.0.50.72]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id BCDD93EE0AE for ; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id A448845DE71 for ; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 8839645DE6A for ; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 79A401DB803F for ; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from ml13.s.css.fujitsu.com (ml13.s.css.fujitsu.com [10.240.81.133]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 41CC91DB803A for ; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from ml13.css.fujitsu.com (ml13 [127.0.0.1]) by ml13.s.css.fujitsu.com (Postfix) with ESMTP id 0AEE1FD0016; Fri, 24 Jun 2011 17:03:35 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.101.131]) by ml13.s.css.fujitsu.com (Postfix) with ESMTP id 77C6DFD0009; Fri, 24 Jun 2011 17:03:34 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KOSANOTE2[10.124.101.131] by KOSANOTE2 (FujitsuOutboundMailChecker v1.3.1/9992[10.124.101.131]); Fri, 24 Jun 2011 17:03:34 +0900 (JST) Message-ID: <4E0444CA.3080407@jp.fujitsu.com> Date: Fri, 24 Jun 2011 17:03:22 +0900 From: KOSAKI Motohiro User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, keithp@keithp.com, airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] i915: slab shrinker have to return -1 if it can't shrink any objects X-Mailman-Approved-At: Fri, 24 Jun 2011 07:25:28 -0700 Cc: kosaki.motohiro@jp.fujitsu.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Now, i915_gem_inactive_shrink() should return -1 instead of 0 if it can't take a lock. Otherwise, vmscan is getting a lot of confusing because vmscan can't distinguish "can't take a lock temporary" and "we've shrank all of i915 objects". Signed-off-by: KOSAKI Motohiro Cc: Keith Packard Cc: David Airlie Cc: dri-devel@lists.freedesktop.org --- I've found this issue by reviewing. I hope i915 developers confirm this. Thx. drivers/gpu/drm/i915/i915_gem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 94c84d7..2f9a9b2 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4104,7 +4104,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc) int cnt; if (!mutex_trylock(&dev->struct_mutex)) - return 0; + return nr_to_scan ? -1 : 0; /* "fast-path" to count number of available objects */ if (nr_to_scan == 0) {