diff mbox series

[v2,2/3] IB/core: Shuffle locks in ib_port_data to save memory

Message ID 20210603065024.1051-3-anand.a.khoje@oracle.com (mailing list archive)
State Superseded
Headers show
Series IB/core: Obtaining subnet_prefix from cache in IB devices. | expand

Commit Message

Anand Khoje June 3, 2021, 6:50 a.m. UTC
pahole shows two 4-byte holes in struct ib_port_data after
pkey_list_lock and netdev_lock respectively.

Shuffling the netdev_lock to be after pkey_list_lock, this 
shaves off eight bytes from the struct.

Suggested-by: Haakon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
---
 include/rdma/ib_verbs.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky June 3, 2021, 8:55 a.m. UTC | #1
On Thu, Jun 03, 2021 at 12:20:23PM +0530, Anand Khoje wrote:
> pahole shows two 4-byte holes in struct ib_port_data after
> pkey_list_lock and netdev_lock respectively.
> 
> Shuffling the netdev_lock to be after pkey_list_lock, this 
> shaves off eight bytes from the struct.
> 
> Suggested-by: Haakon Bugge <haakon.bugge@oracle.com>
> Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
> ---
>  include/rdma/ib_verbs.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff mbox series

Patch

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7e2f369..41cbec5 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2175,11 +2175,13 @@  struct ib_port_data {
 	struct ib_port_immutable immutable;
 
 	spinlock_t pkey_list_lock;
+
+	spinlock_t netdev_lock;
+
 	struct list_head pkey_list;
 
 	struct ib_port_cache cache;
 
-	spinlock_t netdev_lock;
 	struct net_device __rcu *netdev;
 	struct hlist_node ndev_hash_link;
 	struct rdma_port_counter port_counter;