Re: [PATCH for-next 3/6] RDMA/rxe: Save object pointer in pool element
From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-10-20 23:20:55
From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-10-20 23:20:55
On Sun, Oct 10, 2021 at 06:59:28PM -0500, Bob Pearson wrote:
In rxe_pool.c currently there are many cases where it is necessary to compute the offset from a pool element struct to the object containing the pool element in a type independent way. By saving a pointer to the object when they are created extra work can be saved. Signed-off-by: Bob Pearson <redacted> --- drivers/infiniband/sw/rxe/rxe_pool.c | 16 +++++++++------- drivers/infiniband/sw/rxe/rxe_pool.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-)
This would be better to just add a static_assert or build_bug_on that the offsetof() the rxe_pool_entry == 0. There is no reason for these to be sprinkled at every offset Then you don't need to do anything at all Jason