diff mbox

[ovs-dev,11/12] netlink-socket: Reorder elements in nl_dump structure.

Message ID 1475857062-55311-12-git-send-email-bhanuprakash.bodireddy@intel.com
State Changes Requested
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Bodireddy, Bhanuprakash Oct. 7, 2016, 4:17 p.m. UTC
By reordering the elements in nl_dump structure, pad bytes can be
reduced there by saving a cache line.

Before: structure size:72, holes:1, sum padbytes:4, cachelines:2
After: structure size:64, holes:0, sum padbytes:0, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/netlink-socket.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jarno Rajahalme Oct. 7, 2016, 9:13 p.m. UTC | #1
Acked-by: Jarno Rajahalme <jarno@ovn.org>

> On Oct 7, 2016, at 9:17 AM, Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> wrote:
> 
> By reordering the elements in nl_dump structure, pad bytes can be
> reduced there by saving a cache line.
> 
> Before: structure size:72, holes:1, sum padbytes:4, cachelines:2
> After: structure size:64, holes:0, sum padbytes:0, cachelines:1
> 
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
> ---
> lib/netlink-socket.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h
> index f73fc7d..d3cc642 100644
> --- a/lib/netlink-socket.h
> +++ b/lib/netlink-socket.h
> @@ -260,12 +260,12 @@ struct nl_dump {
>     /* These members are immutable during the lifetime of the nl_dump. */
>     struct nl_sock *sock;       /* Socket being dumped. */
>     uint32_t nl_seq;            /* Expected nlmsg_seq for replies. */
> -
> -    /* 'mutex' protects 'status' and serializes access to 'sock'. */
> -    struct ovs_mutex mutex;     /* Protects 'status', synchronizes recv(). */
>     int status OVS_GUARDED;     /* 0: dump in progress,
>                                  * positive errno: dump completed with error,
>                                  * EOF: dump completed successfully. */
> +
> +    /* 'mutex' protects 'status' and serializes access to 'sock'. */
> +    struct ovs_mutex mutex;     /* Protects 'status', synchronizes recv(). */
> };
> 
> void nl_dump_start(struct nl_dump *, int protocol,
> -- 
> 2.4.11
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h
index f73fc7d..d3cc642 100644
--- a/lib/netlink-socket.h
+++ b/lib/netlink-socket.h
@@ -260,12 +260,12 @@  struct nl_dump {
     /* These members are immutable during the lifetime of the nl_dump. */
     struct nl_sock *sock;       /* Socket being dumped. */
     uint32_t nl_seq;            /* Expected nlmsg_seq for replies. */
-
-    /* 'mutex' protects 'status' and serializes access to 'sock'. */
-    struct ovs_mutex mutex;     /* Protects 'status', synchronizes recv(). */
     int status OVS_GUARDED;     /* 0: dump in progress,
                                  * positive errno: dump completed with error,
                                  * EOF: dump completed successfully. */
+
+    /* 'mutex' protects 'status' and serializes access to 'sock'. */
+    struct ovs_mutex mutex;     /* Protects 'status', synchronizes recv(). */
 };
 
 void nl_dump_start(struct nl_dump *, int protocol,