IB/core: Shuffle locks in ib_port_data to save memory
authorAnand Khoje <anand.a.khoje@oracle.com>
Wed, 16 Jun 2021 15:45:08 +0000 (21:15 +0530)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 21 Jun 2021 23:49:32 +0000 (20:49 -0300)
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.

Link: https://lore.kernel.org/r/20210616154509.1047-3-anand.a.khoje@oracle.com
Suggested-by: Haakon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
include/rdma/ib_verbs.h

index 34971c7b988f58100d1c43cb829636ea87f28c5d..371df1c80aeb6c77c687c4291a5983a23ab1322f 100644 (file)
@@ -2176,11 +2176,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;