Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-06-28 Thread Romain Francoise
Michael S. Tsirkin m...@redhat.com writes: On Wed, Jan 23, 2013 at 09:46:47PM +0100, Romain Francoise 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

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-28 Thread Romain Francoise
David Miller da...@davemloft.net writes: I'm not going to apply this vmalloc patch, because if I apply it the fundamental problem here just gets swept under the carpet even longer. No problem, I'll keep this as a local change until vhost-net's allocation strategy gains some sanity. Thanks. --

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-27 Thread David Miller
From: Michael S. Tsirkin m...@redhat.com Date: Wed, 23 Jan 2013 23:04:11 +0200 Maybe we should try and reduce our memory usage, I will look into this. As has been pointed out, 32K of the size is from those iovecs in the queues. The size of this structure is frankly offensive, and even if you

RE: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-24 Thread David Laight
+ n = kmalloc(sizeof *n, GFP_KERNEL | __GFP_NOWARN); + if (!n) + n = vmalloc(sizeof *n); I'm slightly confused by this construct. I thought kmalloc(... GFP_KERNEL) would sleep waiting for memory (rather than return NULL). I realise that (for multi-page sizes) that

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-24 Thread Michael S. Tsirkin
On Thu, Jan 24, 2013 at 09:45:50AM -, David Laight wrote: + n = kmalloc(sizeof *n, GFP_KERNEL | __GFP_NOWARN); + if (!n) + n = vmalloc(sizeof *n); I'm slightly confused by this construct. I thought kmalloc(... GFP_KERNEL) would sleep waiting for memory (rather than

RE: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-24 Thread David Laight
I think this means that kmalloc() is likely to be faster (if it doesn't have to sleep), but that vmalloc() is allocating from a much larger resource. This make me that that large allocations that are not temporary should probably be allocated with vmalloc(). vmalloc has some issues

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-24 Thread Cong Wang
[Followup-To: header set to gmane.linux.network.] On Wed, 23 Jan 2013 at 20:46 GMT, Romain Francoise rom...@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:

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-24 Thread Jason Wang
On Friday, January 25, 2013 03:03:13 AM Cong Wang wrote: [Followup-To: header set to gmane.linux.network.] On Wed, 23 Jan 2013 at 20:46 GMT, Romain Francoise rom...@orebokech.com wrote: Creating a vhost-net device allocates an object large enough (34320 bytes on x86-64) to trigger an

[PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-23 Thread Romain Francoise
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:

Re: [PATCH] vhost-net: fall back to vmalloc if high-order allocation fails

2013-01-23 Thread Michael S. Tsirkin
On Wed, Jan 23, 2013 at 09:46:47PM +0100, Romain Francoise 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 ...