[ovs-dev] [PATCH v2 12/12] timeval: Reorder elements in clock structure.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Thu Oct 13 09:58:35 UTC 2016


By reordering the elements in clock structure, pad bytes
can be reduced and also a cache line is saved.

Before: structure size:136, holes:3, sum padbytes:18, cachelines:3
After: structure size:120, holes:1, sum padbytes:2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
Co-authored-by: Antonio Fischetti <antonio.fischetti at intel.com>
Acked-by: Jarno Rajahalme <jarno at ovn.org>
---
 lib/timeval.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/timeval.c b/lib/timeval.c
index 0e8709a..dd63f03 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -71,10 +71,10 @@ struct clock {
     clockid_t id;               /* CLOCK_MONOTONIC or CLOCK_REALTIME. */
 
     /* Features for use by unit tests.  Protected by 'mutex'. */
-    struct ovs_mutex mutex;
     atomic_bool slow_path;             /* True if warped or stopped. */
-    struct timespec warp OVS_GUARDED;  /* Offset added for unit tests. */
     bool stopped OVS_GUARDED;          /* Disable real-time updates if true. */
+    struct ovs_mutex mutex;
+    struct timespec warp OVS_GUARDED;  /* Offset added for unit tests. */
     struct timespec cache OVS_GUARDED; /* Last time read from kernel. */
     struct large_warp large_warp OVS_GUARDED; /* Connection information waiting
                                                  for warp response. */
-- 
2.4.11




More information about the dev mailing list