From patchwork Tue Jun 15 13:55:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hansen X-Patchwork-Id: 106209 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5FDvacS012980 for ; Tue, 15 Jun 2010 13:57:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932188Ab0FON4j (ORCPT ); Tue, 15 Jun 2010 09:56:39 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:49007 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932152Ab0FONze (ORCPT ); Tue, 15 Jun 2010 09:55:34 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o5FDmS5t002452; Tue, 15 Jun 2010 07:48:28 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5FDtSha077284; Tue, 15 Jun 2010 07:55:29 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5FDtRD0025531; Tue, 15 Jun 2010 07:55:27 -0600 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5FDtQtq025497; Tue, 15 Jun 2010 07:55:26 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by kernel.beaverton.ibm.com (Postfix) with ESMTP id 6A5A21E74F9; Tue, 15 Jun 2010 06:55:26 -0700 (PDT) Subject: [RFC][PATCH 6/9] remove kvm_freed variable To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, Dave Hansen From: Dave Hansen Date: Tue, 15 Jun 2010 06:55:26 -0700 References: <20100615135518.BC244431@kernel.beaverton.ibm.com> In-Reply-To: <20100615135518.BC244431@kernel.beaverton.ibm.com> Message-Id: <20100615135526.C4002017@kernel.beaverton.ibm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 15 Jun 2010 13:57:38 +0000 (UTC) diff -puN arch/x86/kvm/mmu.c~optimize_shrinker-2 arch/x86/kvm/mmu.c --- linux-2.6.git/arch/x86/kvm/mmu.c~optimize_shrinker-2 2010-06-14 10:24:48.000000000 -0700 +++ linux-2.6.git-dave/arch/x86/kvm/mmu.c 2010-06-14 10:24:48.000000000 -0700 @@ -2951,7 +2951,6 @@ static int shrink_kvm_mmu(struct kvm *kv static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) { struct kvm *kvm; - struct kvm *kvm_freed = NULL; if (nr_to_scan == 0) goto out; @@ -2959,18 +2958,14 @@ static int mmu_shrink(int nr_to_scan, gf spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) { - if (nr_to_scan <= 0) - break; + int freed = shrink_kvm_mmu(kvm, nr_to_scan); + if (!freed) + continue; - shrink_kvm_mmu(kvm, nr_to_scan); - if (!kvm_freed) - kvm_freed = kvm; - nr_to_scan--; + list_move_tail(&kvm->vm_list, &vm_list); + break; } - if (kvm_freed) - list_move_tail(&kvm_freed->vm_list, &vm_list); - spin_unlock(&kvm_lock); out: