Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rds:Simplify the allocation of slab caches

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hongfu Li and committed by
David S. Miller
9f1f70dd 382d1741

+2 -6
+1 -3
net/rds/tcp.c
··· 719 719 { 720 720 int ret; 721 721 722 - rds_tcp_conn_slab = kmem_cache_create("rds_tcp_connection", 723 - sizeof(struct rds_tcp_connection), 724 - 0, 0, NULL); 722 + rds_tcp_conn_slab = KMEM_CACHE(rds_tcp_connection, 0); 725 723 if (!rds_tcp_conn_slab) { 726 724 ret = -ENOMEM; 727 725 goto out;
+1 -3
net/rds/tcp_recv.c
··· 337 337 338 338 int rds_tcp_recv_init(void) 339 339 { 340 - rds_tcp_incoming_slab = kmem_cache_create("rds_tcp_incoming", 341 - sizeof(struct rds_tcp_incoming), 342 - 0, 0, NULL); 340 + rds_tcp_incoming_slab = KMEM_CACHE(rds_tcp_incoming, 0); 343 341 if (!rds_tcp_incoming_slab) 344 342 return -ENOMEM; 345 343 return 0;