]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Drivers: net-next: hyperv: Increase the size of the sendbuf region
authorKY Srinivasan <kys@microsoft.com>
Sat, 2 Aug 2014 17:42:02 +0000 (10:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Aug 2014 22:07:14 +0000 (15:07 -0700)
Intel did some benchmarking on our network throughput when Linux on Hyper-V
is as used as a gateway. This fix gave us almost a 1 Gbps additional throughput
on about 5Gbps base throughput we hadi, prior to increasing the sendbuf size.
The sendbuf mechanism is a copy based transport that we have which is clearly
more optimal than the copy-free page flipping mechanism (for small packets).
In the forwarding scenario, we deal only with MTU sized packets,
and increasing the size of the senbuf area gave us the additional performance.
For what it is worth, Windows guests on Hyper-V, I am told use similar sendbuf
size as well.

The exact value of sendbuf I think is less important than the fact that it needs
to be larger than what Linux can allocate as physically contiguous memory.
Thus the change over to allocating via vmalloc().

We currently allocate 16MB receive buffer and we use vmalloc there for allocation.
Also the low level channel code has already been modified to deal with physically
dis-contiguous memory in the ringbuffer setup.

Based on experimentation Intel did, they say there was some improvement in throughput
as the sendbuf size was increased up to 16MB and there was no effect on throughput
beyond 16MB. Thus I have chosen 16MB here.

Increasing the sendbuf value makes a material difference in small packet handling

In this version of the patch, based on David's feedback, I have added
additional details in the commit log.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c

index 24441ae832d108dc304372d03ec99c0e6281e4d8..02a3ee282eee2c54f7f9b34948d7e03680d6b022 100644 (file)
@@ -585,7 +585,7 @@ struct nvsp_message {
 
 #define NETVSC_RECEIVE_BUFFER_SIZE             (1024*1024*16)  /* 16MB */
 #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY      (1024*1024*15)  /* 15MB */
-#define NETVSC_SEND_BUFFER_SIZE                        (1024 * 1024)   /* 1MB */
+#define NETVSC_SEND_BUFFER_SIZE                        (1024 * 1024 * 16)   /* 16MB */
 #define NETVSC_INVALID_INDEX                   -1
 
 
index 592977a6547cd6369df4b9d11a76c056dd2c418d..66979cf7fca6a3d68d88a7c908c45aad2a7b58aa 100644 (file)
@@ -193,8 +193,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device)
        }
        if (net_device->send_buf) {
                /* Free up the receive buffer */
-               free_pages((unsigned long)net_device->send_buf,
-                          get_order(net_device->send_buf_size));
+               vfree(net_device->send_buf);
                net_device->send_buf = NULL;
        }
        kfree(net_device->send_section_map);
@@ -303,9 +302,7 @@ static int netvsc_init_buf(struct hv_device *device)
 
        /* Now setup the send buffer.
         */
-       net_device->send_buf =
-               (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
-                                        get_order(net_device->send_buf_size));
+       net_device->send_buf = vzalloc(net_device->send_buf_size);
        if (!net_device->send_buf) {
                netdev_err(ndev, "unable to allocate send "
                           "buffer of size %d\n", net_device->send_buf_size);