summaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-06-25 12:30:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-17 17:16:05 +0200
commit15e1674de747d58c5a6154ba6e85bc61e5009b08 (patch)
tree31ac562fa3b16908a069a5657d386957e782c7fb /drivers/hv
parent03bad714a1619c0074eb44d6f217c505fe27030f (diff)
downloadlinux-stable-15e1674de747d58c5a6154ba6e85bc61e5009b08.tar.gz
linux-stable-15e1674de747d58c5a6154ba6e85bc61e5009b08.tar.bz2
linux-stable-15e1674de747d58c5a6154ba6e85bc61e5009b08.zip
vmbus: add prefetch to ring buffer iterator
When iterating over incoming ring elements from the host, prefetch the next descriptor so that it is cache hot. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/ring_buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 741daa6e2fc7..12eb8caa4263 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -357,11 +357,16 @@ static u32 hv_pkt_iter_avail(const struct hv_ring_buffer_info *rbi)
struct vmpacket_descriptor *hv_pkt_iter_first(struct vmbus_channel *channel)
{
struct hv_ring_buffer_info *rbi = &channel->inbound;
+ struct vmpacket_descriptor *desc;
if (hv_pkt_iter_avail(rbi) < sizeof(struct vmpacket_descriptor))
return NULL;
- return hv_get_ring_buffer(rbi) + rbi->priv_read_index;
+ desc = hv_get_ring_buffer(rbi) + rbi->priv_read_index;
+ if (desc)
+ prefetch((char *)desc + (desc->len8 << 3));
+
+ return desc;
}
EXPORT_SYMBOL_GPL(hv_pkt_iter_first);