Message ID | 20200218210736.16432-8-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=rjrT=4G=lists.infradead.org=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 130F51395 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 18 Feb 2020 21:09:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E437924670 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 18 Feb 2020 21:09:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QGxSlT3V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E437924670 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bICsbQZwTQ1sCX3iGuaFq/aw9RBi3HyghNAfofXn3bM=; b=QGxSlT3VDPHpFL NbiLNGG/Ht8Fd9sHtPllV/v1Z4G1aOMZBCN+2C0BWBdNNpoQNZtpqijtrd79xEMR/vvWNJrP6pIsZ jrzDq//824lPjPT3DoS3QP/XOk21DkQnOkj/06SBKVclRZ6hIayNNGbCTfMTiXwFwnT/ns4BPbM+W RIUsUmptr590mhRMJlPedmDFViXBK4njOywPGSE/nPj2AzCekMdgQExASi3aYALRW9b7qq6j2gUFD j1xgmW3MswNEEZS65SPh/NFwiRF6mTNID+epGibFwuRt5IDUpl/50uD+f2SM5Z0yfvcxt2scxxEym nAxsNw8crILFd5MXRBtA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4A74-0002FU-Ic; Tue, 18 Feb 2020 21:09:02 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4A5s-0000zt-36 for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2020 21:07:51 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 13:07:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,457,1574150400"; d="scan'208";a="253856414" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga002.jf.intel.com with ESMTP; 18 Feb 2020 13:07:45 -0800 From: Sean Christopherson <sean.j.christopherson@intel.com> To: Paolo Bonzini <pbonzini@redhat.com> Subject: [PATCH v6 07/22] KVM: Explicitly free allocated-but-unused dirty bitmap Date: Tue, 18 Feb 2020 13:07:21 -0800 Message-Id: <20200218210736.16432-8-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200218210736.16432-1-sean.j.christopherson@intel.com> References: <20200218210736.16432-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200218_130748_157773_A5371869 X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.55.52.88 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Wanpeng Li <wanpengli@tencent.com>, kvm@vger.kernel.org, David Hildenbrand <david@redhat.com>, Peter Xu <peterx@redhat.com>, linux-mips@vger.kernel.org, Paul Mackerras <paulus@ozlabs.org>, kvmarm@lists.cs.columbia.edu, Janosch Frank <frankja@linux.ibm.com>, Marc Zyngier <maz@kernel.org>, Joerg Roedel <joro@8bytes.org>, Christian Borntraeger <borntraeger@de.ibm.com>, Julien Thierry <julien.thierry.kdev@gmail.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jim Mattson <jmattson@google.com>, Cornelia Huck <cohuck@redhat.com>, Christoffer Dall <christoffer.dall@arm.com>, Sean Christopherson <sean.j.christopherson@intel.com>, linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>, Vitaly Kuznetsov <vkuznets@redhat.com>, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= <f4bug@amsat.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org |
Series |
KVM: Dynamically size memslot arrays
|
expand
|
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index fba171260ccb..42ec4dac99b3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1093,7 +1093,7 @@ int __kvm_set_memory_region(struct kvm *kvm, slots = kvzalloc(sizeof(struct kvm_memslots), GFP_KERNEL_ACCOUNT); if (!slots) - goto out_free; + goto out_bitmap; memcpy(slots, __kvm_memslots(kvm, as_id), sizeof(struct kvm_memslots)); if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { @@ -1141,8 +1141,9 @@ int __kvm_set_memory_region(struct kvm *kvm, if (change == KVM_MR_DELETE || change == KVM_MR_MOVE) slots = install_new_memslots(kvm, as_id, slots); kvfree(slots); -out_free: - kvm_free_memslot(kvm, &new, &old); +out_bitmap: + if (new.dirty_bitmap && !old.dirty_bitmap) + kvm_destroy_dirty_bitmap(&new); out: return r; }