On Thu, Oct 21, 2021 at 12:21:15PM -0500, Bob Pearson wrote: > On 10/20/21 6:20 PM, Jason Gunthorpe wrote: > > 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 <rpearsonhpe@xxxxxxxxx> > >> 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 > > > I think you missed something. Once upon a time all the rxe objects had the local > pool entry struct followed by the ib_xx struct and then anything else needed locally. > As Leon has been moving the allocations to rdma-core he had to make the ib_xx struct > first followed by the pool element. Oh, I forgot that we were forcing the ib_xx to be at the start already Jason