DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: dev@dpdk.org
Cc: huawei.xie@intel.com, Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-dev] [PATCH 3/3] vhost: arrange virtio_net fields for better cache sharing
Date: Mon,  2 May 2016 17:46:18 -0700	[thread overview]
Message-ID: <1462236378-7604-4-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1462236378-7604-1-git-send-email-yuanhan.liu@linux.intel.com>

the ifname[] field takes so much space, that it seperate some frequently
used fields into different caches, say, features and broadcast_rarp.

This patch move all those fields that will be accessed frequently in Rx/Tx
together (before the ifname[] field) to let them share one cache line.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/vhost-net.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_vhost/vhost-net.h b/lib/librte_vhost/vhost-net.h
index 9dec83c..3b0ffe7 100644
--- a/lib/librte_vhost/vhost-net.h
+++ b/lib/librte_vhost/vhost-net.h
@@ -123,16 +123,16 @@ struct virtio_net {
 	int			vid;
 	uint32_t		flags;
 	uint16_t		vhost_hlen;
+	/* to tell if we need broadcast rarp packet */
+	rte_atomic16_t		broadcast_rarp;
+	uint32_t		virt_qp_nb;
+	struct vhost_virtqueue	*virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
 	char			ifname[IF_NAME_SZ];
-	uint32_t		virt_qp_nb;
 	uint64_t		log_size;
 	uint64_t		log_base;
 	struct ether_addr	mac;
 
-	/* to tell if we need broadcast rarp packet */
-	rte_atomic16_t		broadcast_rarp;
-	struct vhost_virtqueue	*virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
 } __rte_cache_aligned;
 
 /**
-- 
1.9.0

  parent reply	other threads:[~2016-05-03  0:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  0:46 [dpdk-dev] [PATCH 0/3] [RFC] vhost: micro vhost optimization Yuanhan Liu
2016-05-03  0:46 ` [dpdk-dev] [PATCH 1/3] vhost: pre update used ring for Tx and Rx Yuanhan Liu
2016-06-01  6:40   ` Xie, Huawei
2016-06-01  6:55     ` Yuanhan Liu
2016-06-03  8:18       ` Xie, Huawei
2016-06-01 13:05     ` Michael S. Tsirkin
2016-05-03  0:46 ` [dpdk-dev] [PATCH 2/3] vhost: optimize dequeue for small packets Yuanhan Liu
2016-06-01  6:24   ` Xie, Huawei
2016-06-01  6:44     ` Yuanhan Liu
2016-06-03  7:42       ` Xie, Huawei
2016-06-03  7:43   ` Xie, Huawei
2016-05-03  0:46 ` Yuanhan Liu [this message]
2016-06-01  6:42   ` [dpdk-dev] [PATCH 3/3] vhost: arrange virtio_net fields for better cache sharing Xie, Huawei
2016-05-10 21:49 ` [dpdk-dev] [PATCH 0/3] [RFC] vhost: micro vhost optimization Rich Lane
2016-05-10 22:08   ` Yuanhan Liu
2016-06-14 12:42 ` Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462236378-7604-4-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).