diff mbox series

[ovs-dev,09/13] dpif: Reorder elements in dpif_flow_put structure.

Message ID 1504893565-110166-10-git-send-email-bhanuprakash.bodireddy@intel.com
State Rejected
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 dpif_flow_put structure, holes can be removed.

Before: structure size: 80, sum holes: 8, cachelines:2
After : structure size: 72, sum holes: 0, cachelines:2

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

Comments

Ben Pfaff Nov. 3, 2017, 8:02 p.m. UTC | #1
On Fri, Sep 08, 2017 at 06:59:21PM +0100, Bhanuprakash Bodireddy wrote:
> By reordering elements in dpif_flow_put structure, holes can be removed.
> 
> Before: structure size: 80, sum holes: 8, cachelines:2
> After : structure size: 72, sum holes: 0, cachelines:2
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>

Thanks for the patch.  This is one case where I don't think the change
is worth it.  The structure is a little smaller, but this structure is
generally on the stack and often part of union dpif_op, and I think that
moving pmd_id to the beginning of the struct makes it look more
important than it is.  So, I'm going to skip this one.
diff mbox series

Patch

diff --git a/lib/dpif.h b/lib/dpif.h
index d9ded8b..bef7845 100644
--- a/lib/dpif.h
+++ b/lib/dpif.h
@@ -638,6 +638,7 @@  enum dpif_op_type {
  */
 struct dpif_flow_put {
     /* Input. */
+    unsigned pmd_id;                /* Datapath poll mode driver id. */
     enum dpif_flow_put_flags flags; /* DPIF_FP_*. */
     const struct nlattr *key;       /* Flow to put. */
     size_t key_len;                 /* Length of 'key' in bytes. */
@@ -646,7 +647,6 @@  struct dpif_flow_put {
     const struct nlattr *actions;   /* Actions to perform on flow. */
     size_t actions_len;             /* Length of 'actions' in bytes. */
     const ovs_u128 *ufid;           /* Optional unique flow identifier. */
-    unsigned pmd_id;                /* Datapath poll mode driver id. */
 
     /* Output. */
     struct dpif_flow_stats *stats;  /* Optional flow statistics. */