From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roland Dreier Subject: Re: [RFC][PATCH] reduce KVM stack usage Date: Thu, 17 Jul 2008 08:40:08 -0700 Message-ID: References: <1216308735.9161.3.camel@nimitz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm-devel , Anthony Liguori To: Dave Hansen Return-path: Received: from sj-iport-1.cisco.com ([171.71.176.70]:17002 "EHLO sj-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754130AbYGQPkp (ORCPT ); Thu, 17 Jul 2008 11:40:45 -0400 In-Reply-To: <1216308735.9161.3.camel@nimitz> (Dave Hansen's message of "Thu, 17 Jul 2008 08:32:15 -0700") Sender: kvm-owner@vger.kernel.org List-ID: > + struct kvm_pv_mmu_op_buffer *buffer = > + kmalloc(GFP_KERNEL, sizeof(struct kvm_pv_mmu_op_buffer)); Surely this produces a warning? kmalloc takes (size, flags) -- you have them reversed here. > + lapic = kzalloc(GFP_KERNEL, sizeof(*lapic)); > + lapic = kmalloc(GFP_KERNEL, sizeof(*lapic)); > + struct kvm_irqchip *chip = kmalloc(GFP_KERNEL, sizeof(*chip)); > + kvm_sregs = kmalloc(GFP_KERNEL, sizeof kvm_sregs); > + fpu = kmalloc(GFP_KERNEL, sizeof(*fpu)); same for all of these places. > + if (lapic) > + kfree(lapic); > + if (fpu) > + kfree(fpu); > + if (kvm_sregs) > + kfree(kvm_sregs); kfree(NULL) is fine, so you can remove the if()s here.