On Mon, Oct 07, 2024 at 01:37:26PM -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> > --- > drivers/infiniband/ulp/srpt/ib_srpt.c | 79 +++++++++++++++++++++++---- > 1 file changed, 67 insertions(+), 12 deletions(-) > > 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. <...> > + if (IS_ERR(xa_store(&srpt_memory_caches, object_size, e, GFP_KERNEL))) xarray API needs to be checked with xa_is_err() instead of IS_ERR(). Thanks