[PATCH net-next] rxrpc: Simplify the allocation of slab caches

Kunwu Chan posted 1 patch 1 year, 10 months ago
net/rxrpc/af_rxrpc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH net-next] rxrpc: Simplify the allocation of slab caches
Posted by Kunwu Chan 1 year, 10 months ago
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>
---
 net/rxrpc/af_rxrpc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 465bfe5eb061..1326a1bff2d7 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -1026,9 +1026,7 @@ static int __init af_rxrpc_init(void)
 
 	ret = -ENOMEM;
 	rxrpc_gen_version_string();
-	rxrpc_call_jar = kmem_cache_create(
-		"rxrpc_call_jar", sizeof(struct rxrpc_call), 0,
-		SLAB_HWCACHE_ALIGN, NULL);
+	rxrpc_call_jar = KMEM_CACHE(rxrpc_call,	SLAB_HWCACHE_ALIGN);
 	if (!rxrpc_call_jar) {
 		pr_notice("Failed to allocate call jar\n");
 		goto error_call_jar;
-- 
2.39.2
Re: [net-next] rxrpc: Simplify the allocation of slab caches
Posted by Markus Elfring 1 year, 10 months ago
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.

* Please replace the word “new” by a reference to the commit 0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64
  ("KMEM_CACHE(): simplify slab cache creation").

  See also related background information from 2007-05-06.

* Would you like to take another look at possibilities to group
  similar source code transformations into patch series?


Regards,
Markus
Re: [PATCH net-next] rxrpc: Simplify the allocation of slab caches
Posted by Jiri Pirko 1 year, 10 months ago
Thu, Feb 01, 2024 at 11:09:24AM CET, chentao@kylinos.cn wrote:
>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>

btw, why don't you bulk these changes into patchsets of 15 patches? Or,
given the low complexicity of the patch, just merge multiple patches
that are changing similar locations togeter.