diff mbox series

mbcache: Simplify the allocation of slab caches

Message ID 20240201093426.207932-1-chentao@kylinos.cn (mailing list archive)
State New
Headers show
Series mbcache: Simplify the allocation of slab caches | expand

Commit Message

Kunwu Chan Feb. 1, 2024, 9:34 a.m. UTC
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>
---
 fs/mbcache.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jan Kara Feb. 1, 2024, 9:40 a.m. UTC | #1
On Thu 01-02-24 17:34:26, Kunwu Chan 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>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/mbcache.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/mbcache.c b/fs/mbcache.c
> index 82aa7a35db26..fe2624e17253 100644
> --- a/fs/mbcache.c
> +++ b/fs/mbcache.c
> @@ -426,9 +426,8 @@ EXPORT_SYMBOL(mb_cache_destroy);
>  
>  static int __init mbcache_init(void)
>  {
> -	mb_entry_cache = kmem_cache_create("mbcache",
> -				sizeof(struct mb_cache_entry), 0,
> -				SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);
> +	mb_entry_cache = KMEM_CACHE(mb_cache_entry,
> +					 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD);
>  	if (!mb_entry_cache)
>  		return -ENOMEM;
>  	return 0;
> -- 
> 2.39.2
>
Christian Brauner Feb. 1, 2024, 1:43 p.m. UTC | #2
On Thu, 01 Feb 2024 17:34:26 +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] mbcache: Simplify the allocation of slab caches
      https://git.kernel.org/vfs/vfs/c/879fe799ad2b
diff mbox series

Patch

diff --git a/fs/mbcache.c b/fs/mbcache.c
index 82aa7a35db26..fe2624e17253 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -426,9 +426,8 @@  EXPORT_SYMBOL(mb_cache_destroy);
 
 static int __init mbcache_init(void)
 {
-	mb_entry_cache = kmem_cache_create("mbcache",
-				sizeof(struct mb_cache_entry), 0,
-				SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);
+	mb_entry_cache = KMEM_CACHE(mb_cache_entry,
+					 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD);
 	if (!mb_entry_cache)
 		return -ENOMEM;
 	return 0;