linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] khugepaged: Simplify the allocation of slab caches
@ 2024-06-18  1:45 Hongfu Li
  2024-06-18  7:37 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Hongfu Li @ 2024-06-18  1:45 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Hongfu Li

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>
---
 mm/khugepaged.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 774a97e6e2da..f8d08b49420c 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -385,10 +385,7 @@ int hugepage_madvise(struct vm_area_struct *vma,
 
 int __init khugepaged_init(void)
 {
-	mm_slot_cache = kmem_cache_create("khugepaged_mm_slot",
-					  sizeof(struct khugepaged_mm_slot),
-					  __alignof__(struct khugepaged_mm_slot),
-					  0, NULL);
+	mm_slot_cache = KMEM_CACHE(khugepaged_mm_slot, 0);
 	if (!mm_slot_cache)
 		return -ENOMEM;
 
-- 
2.25.1



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

* Re: [PATCH] khugepaged: Simplify the allocation of slab caches
  2024-06-18  1:45 [PATCH] khugepaged: Simplify the allocation of slab caches Hongfu Li
@ 2024-06-18  7:37 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2024-06-18  7:37 UTC (permalink / raw)
  To: Hongfu Li, akpm; +Cc: linux-mm, linux-kernel

On 18.06.24 03:45, Hongfu Li wrote:
> 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>
> ---
>   mm/khugepaged.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 774a97e6e2da..f8d08b49420c 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -385,10 +385,7 @@ int hugepage_madvise(struct vm_area_struct *vma,
>   
>   int __init khugepaged_init(void)
>   {
> -	mm_slot_cache = kmem_cache_create("khugepaged_mm_slot",
> -					  sizeof(struct khugepaged_mm_slot),
> -					  __alignof__(struct khugepaged_mm_slot),
> -					  0, NULL);
> +	mm_slot_cache = KMEM_CACHE(khugepaged_mm_slot, 0);
>   	if (!mm_slot_cache)
>   		return -ENOMEM;
>   

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



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

end of thread, other threads:[~2024-06-18  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18  1:45 [PATCH] khugepaged: Simplify the allocation of slab caches Hongfu Li
2024-06-18  7:37 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox