On Wed, Oct 09, 2024 at 02:00:48PM -0700, Bart Van Assche wrote: > Since commit 4c39529663b9 ("slab: Warn on duplicate cache names when > DEBUG_VM=y"), slab complains about duplicate cache names. Hence this > patch. The approach is as follows: > - Maintain an xarray with the slab size as index and a reference count > and a kmem_cache pointer as contents. Use srpt-${slab_size} as kmem > cache name. > - Use 512-byte alignment for all slabs instead of only for some of the > slabs. > - Increment the reference count instead of calling kmem_cache_create(). > - Decrement the reference count instead of calling kmem_cache_destroy(). > > Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > Closes: https://lore.kernel.org/linux-block/xpe6bea7rakpyoyfvspvin2dsozjmjtjktpph7rep3h25tv7fb@ooz4cu5z6bq6/ > Cc: Zhu Yanjun <yanjun.zhu@xxxxxxxxx> > Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > Fixes: 5dabcd0456d7 ("RDMA/srpt: Add support for immediate data") > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > --- > > Changes compared to v2: > - Use xa_is_err() instead of IS_ERR() to check the xa_store() result. > - Removed a WARN_ON_ONCE() statement that would never trigger a warning. > > Changes compared to v1: > - Instead of using an ida to make slab names unique, maintain an xarray > with the slab size as index and the slab pointer and a reference count as > contents. > > drivers/infiniband/ulp/srpt/ib_srpt.c | 80 +++++++++++++++++++++++---- > 1 file changed, 68 insertions(+), 12 deletions(-) Applied to for-rc, thanks Jason