From patchwork Fri Dec 9 13:42:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9468243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 484E660231 for ; Fri, 9 Dec 2016 13:42:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39E7228576 for ; Fri, 9 Dec 2016 13:42:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E1A328573; Fri, 9 Dec 2016 13:42:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3D4E28573 for ; Fri, 9 Dec 2016 13:42:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C7D66E9D1; Fri, 9 Dec 2016 13:42:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 988E46E9D1 for ; Fri, 9 Dec 2016 13:42:36 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id m203so4125491wma.3 for ; Fri, 09 Dec 2016 05:42:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=pgZeEbsgHXMO6VvaLSqxs8PDFfT/bBISY+HqYUNusRo=; b=u3N9SralzH56/RuC4FVAArdvYM2iW0bF3LCjWqPgy9xT58kUve+RzceZmu9MHWiEDF gpd0ErHsapvdW1lRJ+oDm3s2rGJmkCVGwK1Pmbi7HiKh0eeua8M+eqQ0osYd7eUO1IOZ fYBMuGiwjrOBgh1Gt4DKnmChtwIePQJKIF/nWTPlD/QtufOESPvcj/PK9E788424OTST YTLWFKwXyLMHzz8C+EK33IWALre7XLpOjYL7u2A46EH/W00RLedDxsyDGlPmMWUpzsgL hFF7hiCUwx+p4XwhiyT2COCE8A72TDv+jKpnjYyOUAU06h0tcLHSrHy0mxGb5e0xE7pw 4G5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=pgZeEbsgHXMO6VvaLSqxs8PDFfT/bBISY+HqYUNusRo=; b=aZ/4R3N6r7lo+T3tjcpFwPfyO9G+fqHSDDmxUhQIufgEz2IiXOLGXLEC4FCgMei50Y fFs8nTxxE6XtSPv66aJPDll6qpho+vkg2dM203jF11ASeb9pDherzRjt/TRBIcq30PcH dlod+haqPtxtkadYeKIKjVJoam2U6P6XN7x6ochqcy82Kj3LFJOYEfIv5pGj5G3w0DkX LM6AOlejAM32uTBfqpUyhQpabKGUOaJZDF36rtFtaZAdb/9q/CwIRRtIkDvp3HSv9qgJ 4Qcz1DDfC+WchJSDUirOT7SZzyXHmqtph/ftzrDyM0FtYyLvPCAlKnw1NmwrUg2fnlj/ lQSw== X-Gm-Message-State: AKaTC02xVYPEfArb2f39ezl1OBCGAzvDglmKqGhHFCH4jw9VVgTFABbtByBPMX7ba/xobg== X-Received: by 10.28.140.136 with SMTP id o130mr7080896wmd.76.1481290955021; Fri, 09 Dec 2016 05:42:35 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id ia7sm42279559wjb.23.2016.12.09.05.42.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 05:42:33 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 9 Dec 2016 13:42:32 +0000 Message-Id: <20161209134232.24996-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH] drm/i915: Retire before attempting to evict from the active lists X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Some object retain an extra pin whilst they are active (e.g. contexts). This excludes them from being considered for eviction unless we idle the GPU. If before we look at the active list, before we retire we can hopefully remove a few excess pins and reduce the amount of searching required.. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_evict.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index a3f7f1ca6f21..722b52ff85c1 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c @@ -130,7 +130,14 @@ i915_gem_evict_something(struct i915_address_space *vm, start, end, flags & PIN_HIGH ? DRM_MM_INSERT_HIGH : 0); - if (flags & PIN_NONBLOCK) + /* Retire before we search the active list. Although we have + * reasonable accuracy in our retirement lists, we may have + * a stray pin (preventing eviction) that can only be resolved by + * retiring. + */ + if (!(flags & PIN_NONBLOCK)) + i915_gem_retire_requests(dev_priv); + else phases[1] = NULL; search_again: