[ovs-dev,10/13] ofproto: Reorder elements in ofproto_ipfix_flow_exporter_options structure.

Message ID 1504893565-110166-11-git-send-email-bhanuprakash.bodireddy@intel.com
State Rejected
Headers show
Series
  • Rearrange structure members for memory efficiency.
Related show

Commit Message

Bhanuprakash Bodireddy Sept. 8, 2017, 5:59 p.m.
By reordering elements in ofproto_ipfix_flow_exporter_options structure,
sum holes can be reduced significantly.

Before: structure size: 64, sum holes: 11, cachelines:1
After : structure size: 56, sum holes:  3, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 ofproto/ofproto.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 3, 2017, 8:04 p.m. | #1
On Fri, Sep 08, 2017 at 06:59:22PM +0100, Bhanuprakash Bodireddy wrote:
> By reordering elements in ofproto_ipfix_flow_exporter_options structure,
> sum holes can be reduced significantly.
> 
> Before: structure size: 64, sum holes: 11, cachelines:1
> After : structure size: 56, sum holes:  3, cachelines:1
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> ---
>  ofproto/ofproto.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
> index 1e48e19..9e35327 100644
> --- a/ofproto/ofproto.h
> +++ b/ofproto/ofproto.h
> @@ -87,10 +87,10 @@ struct ofproto_ipfix_bridge_exporter_options {
>  
>  struct ofproto_ipfix_flow_exporter_options {
>      uint32_t collector_set_id;
> +    bool enable_tunnel_sampling;
>      struct sset targets;
>      uint32_t cache_active_timeout;
>      uint32_t cache_max_flows;
> -    bool enable_tunnel_sampling;
>      char *virtual_obs_id;
>  };

This is another case where performance isn't important and I think that
the current ordering is clearer, so I'll skip this one.

Patch

diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 1e48e19..9e35327 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -87,10 +87,10 @@  struct ofproto_ipfix_bridge_exporter_options {
 
 struct ofproto_ipfix_flow_exporter_options {
     uint32_t collector_set_id;
+    bool enable_tunnel_sampling;
     struct sset targets;
     uint32_t cache_active_timeout;
     uint32_t cache_max_flows;
-    bool enable_tunnel_sampling;
     char *virtual_obs_id;
 };