diff mbox series

[ovs-dev,03/13] tun-metadata: Reorder elements in tun_meta_entry structure.

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

Commit Message

Bodireddy, Bhanuprakash Sept. 8, 2017, 5:59 p.m. UTC
By reordering elements in tun_meta_entry structure, sum holes and pad
bytes can be reduced there by reducing the tun_table size.

Before: structure size: 56, sum holes: 4, pad bytes: 7  cachelines:1
After : structure size: 48, sum holes: 0, pad bytes: 3, cachelines:1

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

Comments

Ben Pfaff Nov. 3, 2017, 7:53 p.m. UTC | #1
On Fri, Sep 08, 2017 at 06:59:15PM +0100, Bhanuprakash Bodireddy wrote:
> By reordering elements in tun_meta_entry structure, sum holes and pad
> bytes can be reduced there by reducing the tun_table size.
> 
> Before: structure size: 56, sum holes: 4, pad bytes: 7  cachelines:1
> After : structure size: 48, sum holes: 0, pad bytes: 3, cachelines:1
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

Thanks, applied to master.
diff mbox series

Patch

diff --git a/lib/tun-metadata.c b/lib/tun-metadata.c
index 2fbd9b6..0cb2456 100644
--- a/lib/tun-metadata.c
+++ b/lib/tun-metadata.c
@@ -32,8 +32,8 @@ 
 
 struct tun_meta_entry {
     struct hmap_node node;      /* In struct tun_table's key_hmap. */
-    uint32_t key;               /* (class << 8) | type. */
     struct tun_metadata_loc loc;
+    uint32_t key;               /* (class << 8) | type. */
     bool valid;                 /* True if allocated to a class and type. */
 };