netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: kvm@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails
Date: Fri, 25 Jan 2013 03:03:13 +0000 (UTC)	[thread overview]
Message-ID: <kdsslg$ddn$1@ger.gmane.org> (raw)
In-Reply-To: 87k3r31vbc.fsf@silenus.orebokech.com

["Followup-To:" header set to gmane.linux.network.]
On Wed, 23 Jan 2013 at 20:46 GMT, Romain Francoise <romain@orebokech.com> wrote:
> Creating a vhost-net device allocates an object large enough (34320 bytes
> on x86-64) to trigger an order-4 allocation, which may fail if memory if
> fragmented:
>
>  libvirtd: page allocation failure: order:4, mode:0x2000d0
>  ...
>  SLAB: Unable to allocate memory on node 0 (gfp=0xd0)
>    cache: size-65536, object size: 65536, order: 4
>    node 0: slabs: 8/8, objs: 8/8, free: 0
>
> In that situation, rather than forcing the caller to use regular
> virtio-net, try to allocate the descriptor with vmalloc().
>


The real problem is vhost_net struct is really big, it
should be reduced rather than workarounded like this.


> +static void vhost_net_kvfree(void *addr)
> +{
> +	if (is_vmalloc_addr(addr))
> +		vfree(addr);
> +	else
> +		kfree(addr);
> +}
> +

This kind of stuff should really go to mm, not netdev.


  parent reply	other threads:[~2013-01-25  3:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 20:46 [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails Romain Francoise
2013-01-23 21:04 ` Michael S. Tsirkin
2013-01-28  3:11   ` David Miller
2013-01-28  9:23     ` Romain Francoise
2013-06-28  7:16   ` Romain Francoise
2013-01-24  9:45 ` David Laight
2013-01-24 10:06   ` Michael S. Tsirkin
2013-01-24 10:37     ` David Laight
2013-01-25  3:03 ` Cong Wang [this message]
2013-01-25  5:15   ` Jason Wang

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='kdsslg$ddn$1@ger.gmane.org' \
    --to=xiyou.wangcong@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).