diff mbox

[ovs-dev] dpif-netdev: Reorder elements in dp_netdev_port structure.

Message ID 1500956327-45333-1-git-send-email-bhanuprakash.bodireddy@intel.com
State Accepted
Headers show

Commit Message

Bodireddy, Bhanuprakash July 25, 2017, 4:18 a.m. UTC
By reordering the elements in dp_netdev_port structure, pad bytes can be
reduced there by saving a cache line. Marginal performance improvement
is also observed with this change.

Before: structure size: 136, holes: 7, sum padbytes:7, cachelines:3
After : structure size: 128, holes: 6, sum padbytes:0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 lib/dpif-netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gregory Rose July 26, 2017, 8:50 p.m. UTC | #1
On 07/24/2017 09:18 PM, Bhanuprakash Bodireddy wrote:
> By reordering the elements in dp_netdev_port structure, pad bytes can be
> reduced there by saving a cache line. Marginal performance improvement
> is also observed with this change.
>
> Before: structure size: 136, holes: 7, sum padbytes:7, cachelines:3
> After : structure size: 128, holes: 6, sum padbytes:0, cachelines:2
>
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> ---
>   lib/dpif-netdev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 47a9fa0..fb5d612 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -351,17 +351,17 @@ struct dp_netdev_rxq {
>   /* A port in a netdev-based datapath. */
>   struct dp_netdev_port {
>       odp_port_t port_no;
> +    bool dynamic_txqs;          /* If true XPS will be used. */
> +    bool need_reconfigure;      /* True if we should reconfigure netdev. */
>       struct netdev *netdev;
>       struct hmap_node node;      /* Node in dp_netdev's 'ports'. */
>       struct netdev_saved_flags *sf;
>       struct dp_netdev_rxq *rxqs;
>       unsigned n_rxq;             /* Number of elements in 'rxqs' */
> -    bool dynamic_txqs;          /* If true XPS will be used. */
>       unsigned *txq_used;         /* Number of threads that use each tx queue. */
>       struct ovs_mutex txq_used_mutex;
>       char *type;                 /* Port type as requested by user. */
>       char *rxq_affinity_list;    /* Requested affinity of rx queues. */
> -    bool need_reconfigure;      /* True if we should reconfigure netdev. */
>   };
>
>   /* Contained by struct dp_netdev_flow's 'stats' member.  */
>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 47a9fa0..fb5d612 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -351,17 +351,17 @@  struct dp_netdev_rxq {
 /* A port in a netdev-based datapath. */
 struct dp_netdev_port {
     odp_port_t port_no;
+    bool dynamic_txqs;          /* If true XPS will be used. */
+    bool need_reconfigure;      /* True if we should reconfigure netdev. */
     struct netdev *netdev;
     struct hmap_node node;      /* Node in dp_netdev's 'ports'. */
     struct netdev_saved_flags *sf;
     struct dp_netdev_rxq *rxqs;
     unsigned n_rxq;             /* Number of elements in 'rxqs' */
-    bool dynamic_txqs;          /* If true XPS will be used. */
     unsigned *txq_used;         /* Number of threads that use each tx queue. */
     struct ovs_mutex txq_used_mutex;
     char *type;                 /* Port type as requested by user. */
     char *rxq_affinity_list;    /* Requested affinity of rx queues. */
-    bool need_reconfigure;      /* True if we should reconfigure netdev. */
 };
 
 /* Contained by struct dp_netdev_flow's 'stats' member.  */