]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netvsc: prefetch the first incoming ring element
authorstephen hemminger <stephen@networkplumber.org>
Mon, 24 Jul 2017 17:57:27 +0000 (10:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 00:38:28 +0000 (17:38 -0700)
In interrupt handler, prefetch the first incoming ring element
so that it is in cache by the time NAPI poll gets to it.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc.c

index 0a9d9feedc3f4d6e31cdfe80cee3f9aa3d4f078a..06f39a99da7c6ad1a43a28ab3428b0d73c9e0128 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/if_ether.h>
 #include <linux/vmalloc.h>
 #include <linux/rtnetlink.h>
+#include <linux/prefetch.h>
 
 #include <asm/sync_bitops.h>
 
@@ -1265,10 +1266,15 @@ int netvsc_poll(struct napi_struct *napi, int budget)
 void netvsc_channel_cb(void *context)
 {
        struct netvsc_channel *nvchan = context;
+       struct vmbus_channel *channel = nvchan->channel;
+       struct hv_ring_buffer_info *rbi = &channel->inbound;
+
+       /* preload first vmpacket descriptor */
+       prefetch(hv_get_ring_buffer(rbi) + rbi->priv_read_index);
 
        if (napi_schedule_prep(&nvchan->napi)) {
                /* disable interupts from host */
-               hv_begin_read(&nvchan->channel->inbound);
+               hv_begin_read(rbi);
 
                __napi_schedule(&nvchan->napi);
        }