sctp: Simplify the allocation of slab caches
authorKunwu Chan <chentao@kylinos.cn>
Wed, 31 Jan 2024 08:45:49 +0000 (16:45 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Feb 2024 12:17:32 +0000 (12:17 +0000)
commit 0a31bd5f2bbb ("KMEM_CACHE(): simplify slab cache creation")
introduces a new macro.
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/protocol.c

index 94c6dd53cd62d1fa6236d07946e8d5ff68eb587d..e849f368ed91348ed0024bed47eb59345bf91d9b 100644 (file)
@@ -1495,17 +1495,11 @@ static __init int sctp_init(void)
 
        /* Allocate bind_bucket and chunk caches. */
        status = -ENOBUFS;
-       sctp_bucket_cachep = kmem_cache_create("sctp_bind_bucket",
-                                              sizeof(struct sctp_bind_bucket),
-                                              0, SLAB_HWCACHE_ALIGN,
-                                              NULL);
+       sctp_bucket_cachep = KMEM_CACHE(sctp_bind_bucket, SLAB_HWCACHE_ALIGN);
        if (!sctp_bucket_cachep)
                goto out;
 
-       sctp_chunk_cachep = kmem_cache_create("sctp_chunk",
-                                              sizeof(struct sctp_chunk),
-                                              0, SLAB_HWCACHE_ALIGN,
-                                              NULL);
+       sctp_chunk_cachep = KMEM_CACHE(sctp_chunk, SLAB_HWCACHE_ALIGN);
        if (!sctp_chunk_cachep)
                goto err_chunk_cachep;