Message ID | 1504893565-110166-2-git-send-email-bhanuprakash.bodireddy@intel.com |
---|---|
State | Accepted |
Headers | show |
Series | Rearrange structure members for memory efficiency. | expand |
On Fri, Sep 08, 2017 at 06:59:13PM +0100, Bhanuprakash Bodireddy wrote: > By reordering elements in bond_slave structure, holes can be removed and > saves a cache line. > > Before: structure size: 136, sum holes: 10, cachelines:3 > After : structure size: 128, sum holes: 2, cachelines:2 > > Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> I don't think that performance is important for this structure, but I like the reduction in size. Applied to master, thanks!
diff --git a/ofproto/bond.c b/ofproto/bond.c index 365a3ca..a656226 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -88,13 +88,13 @@ struct bond_slave { struct netdev *netdev; /* Network device, owned by the client. */ uint64_t change_seq; /* Tracks changes in 'netdev'. */ - ofp_port_t ofp_port; /* OpenFlow port number. */ char *name; /* Name (a copy of netdev_get_name(netdev)). */ + ofp_port_t ofp_port; /* OpenFlow port number. */ /* Link status. */ - long long delay_expires; /* Time after which 'enabled' may change. */ bool enabled; /* May be chosen for flows? */ bool may_enable; /* Client considers this slave bondable. */ + long long delay_expires; /* Time after which 'enabled' may change. */ /* Rebalancing info. Used only by bond_rebalance(). */ struct ovs_list bal_node; /* In bond_rebalance()'s 'bals' list. */
By reordering elements in bond_slave structure, holes can be removed and saves a cache line. Before: structure size: 136, sum holes: 10, cachelines:3 After : structure size: 128, sum holes: 2, cachelines:2 Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> --- ofproto/bond.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)