Re: [PATCH for-next 3/6] RDMA/rxe: Save object pointer in pool element

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux