From patchwork Fri Oct 7 09:46:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9365875 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 5235260487 for ; Fri, 7 Oct 2016 09:47:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 428A429469 for ; Fri, 7 Oct 2016 09:47:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3787C2946C; Fri, 7 Oct 2016 09:47:25 +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 0293629469 for ; Fri, 7 Oct 2016 09:47:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72EA86EB53; Fri, 7 Oct 2016 09:47:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 570076EB44 for ; Fri, 7 Oct 2016 09:47:10 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id 123so2085129wmb.3 for ; Fri, 07 Oct 2016 02:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=eFumLxcTmJgn5XpgqNtWxsnLCSjjXCNVnOFgs75i6DA=; b=h0YztQ4Scm4gAv1CdKsK8G0DdFYM0DGQgFbjTqMQLVty1Z+xDv6pYh5xwvojI2Gn9o PZ1wi1LyH41p7nnAoD45ByPsYZGxj/25Ze5JqgplpSH/kpYlixrLH0jKje50Kj5iDIyd XBlbB4DsOUQWMB2LJTVgvuHThFhJ2SkNVGry8eIUtyqu9BQkXvAxiNhHkVN8OV/846ur X5JJN+zrTo1f8Sy9aNK0wtTz/mfZwQ6flYjqRcGSxj1MQoLNQeDo5UgsFuEbYYGr4nQg GQEQ5LLEjiU4LbhzStknq17cOjFFVInbjvSdn0R2mmeDMuZ4hYE4ErsDmCCIFTTZrQbu PGkw== 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 :in-reply-to:references; bh=eFumLxcTmJgn5XpgqNtWxsnLCSjjXCNVnOFgs75i6DA=; b=mR2JiG9oyhccBL0sE2KdynpG/fE2UF5gVCHQtfGoXy5DrXYhpgQ7Jx4BpixWa2E9um Mr+qsSQNy2NoqQzrDpZJYGDMVX2xLY9lkrldMbE2yq58UmDDD/X1qArLXz8vJmIO02Uo vmM/zEiD7Vjhmy5b/MW6r7JrI7HsAR1aqg6eoqhzBiuye0dKU4LsZMtq9nPCBGx7Eohz g9q8YiC2zf+u9UuI0fOJPQ4U2ILwloe8D/YRAWSrEiK7rGxokazRLdyezqXvYF86Pkfb ykCWwGULpnj254H7CQ521W5jaLdeK1QaWZEmFOAjjEGLnWJlvKsn7Qg5TN6haT76F9Rz DcMQ== X-Gm-Message-State: AA6/9RmgqBZc/1TxHFM0wI1vMsVKnPN6LzamgMVQQRXbpt7gTJ2+DN0BFyEXJe0M1nIIXw== X-Received: by 10.194.201.103 with SMTP id jz7mr4929361wjc.70.1475833628312; Fri, 07 Oct 2016 02:47:08 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id h3sm18877585wjp.45.2016.10.07.02.47.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Oct 2016 02:47:07 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Oct 2016 10:46:17 +0100 Message-Id: <20161007094635.28319-25-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161007094635.28319-1-chris@chris-wilson.co.uk> References: <20161007094635.28319-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 24/42] drm/i915: Treat a framebuffer reference as an active reference whilst shrinking 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 Treat a framebuffer reference with the same priority as an active reference whilst shrinking. Framebuffers are likely to be reused and typically cost more to migrate to and from GPU memory (on LLC architectures we need to clflush), so defer the temptation to purge them during a kswapd run until we have run out of cheap buffers. Signed-off-by: Chris Wilson Reviewed-by: John Harrison --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index fa72473dc7f5..0241658af16b 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -214,8 +214,9 @@ i915_gem_shrink(struct drm_i915_private *dev_priv, !is_vmalloc_addr(obj->mm.mapping)) continue; - if ((flags & I915_SHRINK_ACTIVE) == 0 && - i915_gem_object_is_active(obj)) + if (!(flags & I915_SHRINK_ACTIVE) && + (i915_gem_object_is_active(obj) || + obj->framebuffer_references)) continue; if (!can_release_pages(obj))