From patchwork Wed Aug 26 07:01:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyuan Lv X-Patchwork-Id: 7074751 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3B6DA9F358 for ; Wed, 26 Aug 2015 07:09:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EE38208F6 for ; Wed, 26 Aug 2015 07:09:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 072A3208F2 for ; Wed, 26 Aug 2015 07:09:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAF216E579; Wed, 26 Aug 2015 00:09:10 -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 DB3426E579 for ; Wed, 26 Aug 2015 00:09:08 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 26 Aug 2015 00:09:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,414,1437462000"; d="scan'208";a="791101238" Received: from zlv-hp-dev.bj.intel.com ([10.238.158.60]) by orsmga002.jf.intel.com with ESMTP; 26 Aug 2015 00:08:58 -0700 From: Zhiyuan Lv To: intel-gfx@lists.freedesktop.org Date: Wed, 26 Aug 2015 15:01:26 +0800 Message-Id: <1440572486-14715-1-git-send-email-zhiyuan.lv@intel.com> X-Mailer: git-send-email 1.9.1 Cc: benjamin.widawsky@intel.com Subject: [Intel-gfx] [PATCH] Fix list empty check in i915_gem_evict_everything 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-Spam-Status: No, score=-5.6 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 That seems to be a typo. The original code will override the previous list empty check value in the loop. As the result, only the last vm in vm_list impacts the empty check. The problem is fixed by using local bool variable inside the loop. Signed-off-by: Zhiyuan Lv --- drivers/gpu/drm/i915/i915_gem_evict.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index d09e35e..a45cffa 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c @@ -255,10 +255,12 @@ i915_gem_evict_everything(struct drm_device *dev) int ret; list_for_each_entry(vm, &dev_priv->vm_list, global_link) { - lists_empty = (list_empty(&vm->inactive_list) && + bool empty = (list_empty(&vm->inactive_list) && list_empty(&vm->active_list)); - if (!lists_empty) + if (!empty) { lists_empty = false; + break; + } } if (lists_empty)