diff mbox

[ovs-dev,2/5] dpif-netdev: Reorder elements in dp_netdev structure.

Message ID 1489340008-77897-2-git-send-email-bhanuprakash.bodireddy@intel.com
State Accepted
Delegated to: Darrell Ball
Headers show

Commit Message

Bodireddy, Bhanuprakash March 12, 2017, 5:33 p.m. UTC
'emc_insert_min' variable is made to align on a 64-byte boundary and this
introduces a 24 byte hole.

This patch moves the emc_insert_min member variable slightly higher in
the order to remove the hole and thus saves a cache line with the new
ordering.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
CC: Ciara Loftus <ciara.loftus@intel.com>
CC: Georg Schmuecking <georg.schmuecking@ericsson.com>
---
 lib/dpif-netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ben Pfaff May 18, 2017, 9:13 p.m. UTC | #1
On Sun, Mar 12, 2017 at 05:33:25PM +0000, Bhanuprakash Bodireddy wrote:
> 'emc_insert_min' variable is made to align on a 64-byte boundary and this
> introduces a 24 byte hole.
> 
> This patch moves the emc_insert_min member variable slightly higher in
> the order to remove the hole and thus saves a cache line with the new
> ordering.
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> CC: Ciara Loftus <ciara.loftus@intel.com>
> CC: Georg Schmuecking <georg.schmuecking@ericsson.com>

Thanks!  I applied this to master.
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index faadedb..006cea6 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -261,6 +261,9 @@  struct dp_netdev {
     struct dp_meter *meters[MAX_METERS]; /* Meter bands. */
     uint32_t meter_free;                 /* Next free meter. */
 
+    /* Probability of EMC insertions is a factor of 'emc_insert_min'.*/
+    OVS_ALIGNED_VAR(CACHE_LINE_SIZE) atomic_uint32_t emc_insert_min;
+
     /* Protects access to ofproto-dpif-upcall interface during revalidator
      * thread synchronization. */
     struct fat_rwlock upcall_rwlock;
@@ -292,9 +295,6 @@  struct dp_netdev {
     uint64_t last_tnl_conf_seq;
 
     struct conntrack conntrack;
-
-    /* Probability of EMC insertions is a factor of 'emc_insert_min'.*/
-    OVS_ALIGNED_VAR(CACHE_LINE_SIZE) atomic_uint32_t emc_insert_min;
 };
 
 static void meter_lock(const struct dp_netdev *dp, uint32_t meter_id)