Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582AbdFYTbv (ORCPT ); Sun, 25 Jun 2017 15:31:51 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:53742 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbdFYTbc (ORCPT ); Sun, 25 Jun 2017 15:31:32 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: Stephen Hemminger , "K. Y. Srinivasan" Subject: [PATCH 6/6] vmbus: add prefetch to ring buffer iterator Date: Sun, 25 Jun 2017 12:30:29 -0700 Message-Id: <1498419029-4127-6-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1498418991-4071-1-git-send-email-kys@exchange.microsoft.com> References: <1498418991-4071-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfHp661FbwAkK8EmbaDkxbp5CLNTsy1ExEM0+UNJHCS29lta/vIir6X+sxsm9zMxaYQXaA7wB6x7IcVovBHn4crt5qQz2EDzc6rAFkWGJt6DI0OYRxbmm 3DLuUhXRh2sxxOPFNL6jWrKg+pEdV+JvFB4GFlqCi2wpO51kHhE0nBmdYvX13MOxPsvMLIiSMqVvwiOj9f0i/UbKTooFJPtfI9SLJBfNAY+MJzSAhJKH4Ne5 14VtqJuKl7r3lQeL9HvRRTcxqdFKQHfpcyb40BCYYV8/Z3NcYveMbwS3SptgX4XigDE9hFt1viaZYBxvQ6jPm9YkE3ZAcEu2BL0sAK8vZ5K2aj899cefX00K 9ntsEANfFgbZXl2+tHYbW+Ke6meeIttX/LgIBtlpA3twuMVcmNXkPdXIZ2JB6Rqzliv3PbT2UTKEGrV/J9R+B2sgDuZYfb3sn3ZeHiPrgzaoVDvZxxByjJih iq6XTLRWPEltNjX3SD3+hUWMSDzioSlgkveErfDCl0YF3dJrIyXSQgIJFicpFFuSXD8894QG9vPIlhE5UPC/gNrbOcxGYf11wyordA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1123 Lines: 35 From: Stephen Hemminger When iterating over incoming ring elements from the host, prefetch the next descriptor so that it is cache hot. Signed-off-by: Stephen Hemminger Signed-off-by: K. Y. Srinivasan --- drivers/hv/ring_buffer.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 741daa6..12eb8ca 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); -- 1.7.1