public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Avi Kivity <avi@argo.co.il>, kvm-devel <kvm@vger.kernel.org>,
	Anthony Liguori <aliguori@us.ibm.com>
Subject: Re: [RFC][PATCH] reduce KVM stack usage
Date: Thu, 17 Jul 2008 08:40:08 -0700	[thread overview]
Message-ID: <aday7408qp3.fsf@cisco.com> (raw)
In-Reply-To: <1216308735.9161.3.camel@nimitz> (Dave Hansen's message of "Thu, 17 Jul 2008 08:32:15 -0700")

 > +	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.

  reply	other threads:[~2008-07-17 15:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 15:32 [RFC][PATCH] reduce KVM stack usage Dave Hansen
2008-07-17 15:40 ` Roland Dreier [this message]
2008-07-17 17:23   ` Dave Hansen
2008-07-17 23:02     ` Roland Dreier
2008-07-19  7:32 ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aday7408qp3.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@argo.co.il \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox