From patchwork Fri Aug 16 00:30:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Ausmus X-Patchwork-Id: 2845317 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 009AC9F2F5 for ; Fri, 16 Aug 2013 00:39:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFBA1202AE for ; Fri, 16 Aug 2013 00:39:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0604F202A1 for ; Fri, 16 Aug 2013 00:39:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 077D5E64E6 for ; Thu, 15 Aug 2013 17:39:11 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 05D6EE6258 for ; Thu, 15 Aug 2013 17:31:59 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 15 Aug 2013 17:31:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,889,1367996400"; d="scan'208";a="387901465" Received: from jausmus-gentoo-dev5.jf.intel.com ([10.7.198.60]) by orsmga002.jf.intel.com with ESMTP; 15 Aug 2013 17:31:57 -0700 From: james.ausmus@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 15 Aug 2013 17:30:58 -0700 Message-Id: <1376613069-15790-34-git-send-email-james.ausmus@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> References: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] CHROMIUM: drm/i915: Don't evict bound object in the shrinker X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stéphane Marchesin Before swapping, the shrinker gets called on all drivers to try and reclaim some memory before resorting to disk access. For i915, the shrinker will eventually try to move objects out of the GTT to make them swappable. However when this happens too often, this will have two negative effects: - once we have exhausted all the purgeable objects, the remaining objects will start bouncing in and out of the GTT as the rendering drags them in and the shrinker pulls them out - the i915 shrinker needs to wait on the CPU for the GPU to complete pending rendering, which kills all asynchronicity Those two things will slow down the system significantly as soon as we start hitting the shrinker. So in this patch, we change the shrinker to stop evicting in-use GTT objects. This avoids both issues. BUG=none TEST=compiles and runs, seems to behave better under memory pressure Change-Id: Iadb3c28575aae015f0f4b7c16f02e1e7ec6ef95a Reviewed-on: https://gerrit.chromium.org/gerrit/57367 Reviewed-by: Luigi Semenzato Tested-by: Stéphane Marchesin Commit-Queue: Stéphane Marchesin --- drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index de45b60..3a72002 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4402,8 +4402,14 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc) if (nr_to_scan > 0) nr_to_scan -= __i915_gem_shrink(dev_priv, nr_to_scan, false); - if (nr_to_scan > 0) - i915_gem_shrink_all(dev_priv); + + /* We don't want to shrink all objects. When the shrinker is + * called too often, this causes bouncing of GEM objects in + * and out of the GTT, as well as GPU synchronization which + * slows the system to a crawl. + */ + /*if (nr_to_scan > 0) + i915_gem_shrink_all(dev_priv);*/ } cnt = 0;