linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create()
@ 2024-01-16  9:11 Kunwu Chan
  2024-01-16 10:38 ` Jan Kara
  2024-01-16 11:01 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-01-16  9:11 UTC (permalink / raw)
  To: viro, brauner, jack; +Cc: linux-fsdevel, linux-kernel, Kunwu Chan

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/buffer.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index d3bcf601d3e5..9c8156cce9b7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3121,12 +3121,8 @@ void __init buffer_init(void)
 	unsigned long nrpages;
 	int ret;
 
-	bh_cachep = kmem_cache_create("buffer_head",
-			sizeof(struct buffer_head), 0,
-				(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
-				SLAB_MEM_SPREAD),
-				NULL);
-
+	bh_cachep = KMEM_CACHE(buffer_head,
+				SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
 	/*
 	 * Limit the bh occupancy to 10% of ZONE_NORMAL
 	 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create()
  2024-01-16  9:11 [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create() Kunwu Chan
@ 2024-01-16 10:38 ` Jan Kara
  2024-01-16 11:01 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2024-01-16 10:38 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: viro, brauner, jack, linux-fsdevel, linux-kernel

On Tue 16-01-24 17:11:37, 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>

Sure. Feel free to add:

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

								Honza

> ---
>  fs/buffer.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index d3bcf601d3e5..9c8156cce9b7 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -3121,12 +3121,8 @@ void __init buffer_init(void)
>  	unsigned long nrpages;
>  	int ret;
>  
> -	bh_cachep = kmem_cache_create("buffer_head",
> -			sizeof(struct buffer_head), 0,
> -				(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
> -				SLAB_MEM_SPREAD),
> -				NULL);
> -
> +	bh_cachep = KMEM_CACHE(buffer_head,
> +				SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
>  	/*
>  	 * Limit the bh occupancy to 10% of ZONE_NORMAL
>  	 */
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create()
  2024-01-16  9:11 [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create() Kunwu Chan
  2024-01-16 10:38 ` Jan Kara
@ 2024-01-16 11:01 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-01-16 11:01 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: Christian Brauner, linux-fsdevel, linux-kernel, viro, jack

On Tue, 16 Jan 2024 17:11:37 +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] buffer: Use KMEM_CACHE instead of kmem_cache_create()
      https://git.kernel.org/vfs/vfs/c/c838cefc0d95

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-16 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16  9:11 [PATCH] buffer: Use KMEM_CACHE instead of kmem_cache_create() Kunwu Chan
2024-01-16 10:38 ` Jan Kara
2024-01-16 11:01 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).