[ovs-dev,05/13] netdev: Reorder elements in netdev_tunnel_config structure.

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

Commit Message

Bodireddy, Bhanuprakash Sept. 8, 2017, 5:59 p.m.
By reordering elements in netdev_tunnel_config structure, sum holes and
pad bytes can be reduced.

Before: structure size: 96, sum holes: 17, pad bytes: 4, cachelines:2
After : structure size: 80, sum holes:  5, pad bytes: 0, cachelines:2

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

Comments

Ben Pfaff Nov. 3, 2017, 8:07 p.m. | #1
On Fri, Sep 08, 2017 at 06:59:17PM +0100, Bhanuprakash Bodireddy wrote:
> By reordering elements in netdev_tunnel_config structure, sum holes and
> pad bytes can be reduced.
> 
> Before: structure size: 96, sum holes: 17, pad bytes: 4, cachelines:2
> After : structure size: 80, sum holes:  5, pad bytes: 0, cachelines:2
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

Applied, thanks!

Patch

diff --git a/lib/netdev.h b/lib/netdev.h
index f8482f7..3a545fe 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -99,9 +99,9 @@  enum netdev_pt_mode {
 
 /* Configuration specific to tunnels. */
 struct netdev_tunnel_config {
+    ovs_be64 in_key;
     bool in_key_present;
     bool in_key_flow;
-    ovs_be64 in_key;
 
     bool out_key_present;
     bool out_key_flow;
@@ -115,8 +115,8 @@  struct netdev_tunnel_config {
     struct in6_addr ipv6_dst;
 
     uint32_t exts;
-    bool set_egress_pkt_mark;
     uint32_t egress_pkt_mark;
+    bool set_egress_pkt_mark;
 
     uint8_t ttl;
     bool ttl_inherit;