linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm, slab: two minor cleanups
@ 2024-02-21 12:12 Chengming Zhou
  2024-02-21 12:12 ` [PATCH 1/2] mm, slab: remove unused object_size parameter in kmem_cache_flags() Chengming Zhou
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chengming Zhou @ 2024-02-21 12:12 UTC (permalink / raw)
  To: Pekka Enberg, Joonsoo Kim, Andrew Morton, David Rientjes,
	Christoph Lameter, Hyeonggon Yoo, Vlastimil Babka,
	Roman Gushchin
  Cc: Chengming Zhou, linux-mm, linux-kernel

Just two minor cleanups when reviewing the code.

Thanks!

Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
---
Chengming Zhou (2):
      mm, slab: remove unused object_size parameter in kmem_cache_flags()
      mm, slab: fix the comment

 mm/slab.h        |  3 +--
 mm/slab_common.c |  2 +-
 mm/slub.c        | 11 ++++-------
 3 files changed, 6 insertions(+), 10 deletions(-)
---
base-commit: c09a8e005eff6c064e2e9f11549966c36a724fbf
change-id: 20240221-slab-cleanup-df9652186012

Best regards,
-- 
Chengming Zhou <chengming.zhou@linux.dev>


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

* [PATCH 1/2] mm, slab: remove unused object_size parameter in kmem_cache_flags()
  2024-02-21 12:12 [PATCH 0/2] mm, slab: two minor cleanups Chengming Zhou
@ 2024-02-21 12:12 ` Chengming Zhou
  2024-02-21 12:12 ` [PATCH 2/2] mm, slab: fix the comment Chengming Zhou
  2024-02-21 15:23 ` [PATCH 0/2] mm, slab: two minor cleanups Vlastimil Babka
  2 siblings, 0 replies; 4+ messages in thread
From: Chengming Zhou @ 2024-02-21 12:12 UTC (permalink / raw)
  To: Pekka Enberg, Joonsoo Kim, Andrew Morton, David Rientjes,
	Christoph Lameter, Hyeonggon Yoo, Vlastimil Babka,
	Roman Gushchin
  Cc: Chengming Zhou, linux-mm, linux-kernel

We don't need the object_size parameter in kmem_cache_flags(), so
just remove it.

Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
---
 mm/slab.h        | 3 +--
 mm/slab_common.c | 2 +-
 mm/slub.c        | 9 +++------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/mm/slab.h b/mm/slab.h
index 54deeb0428c6..161a3fe5d573 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -435,8 +435,7 @@ struct kmem_cache *
 __kmem_cache_alias(const char *name, unsigned int size, unsigned int align,
 		   slab_flags_t flags, void (*ctor)(void *));
 
-slab_flags_t kmem_cache_flags(unsigned int object_size,
-	slab_flags_t flags, const char *name);
+slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name);
 
 static inline bool is_kmalloc_cache(struct kmem_cache *s)
 {
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 238293b1dbe1..e86557397a61 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -172,7 +172,7 @@ struct kmem_cache *find_mergeable(unsigned int size, unsigned int align,
 	size = ALIGN(size, sizeof(void *));
 	align = calculate_alignment(flags, align, size);
 	size = ALIGN(size, align);
-	flags = kmem_cache_flags(size, flags, name);
+	flags = kmem_cache_flags(flags, name);
 
 	if (flags & SLAB_NEVER_MERGE)
 		return NULL;
diff --git a/mm/slub.c b/mm/slub.c
index 2ef88bbf56a3..95700f2b17ae 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1764,7 +1764,6 @@ __setup("slub_debug", setup_slub_debug);
 
 /*
  * kmem_cache_flags - apply debugging options to the cache
- * @object_size:	the size of an object without meta data
  * @flags:		flags to set
  * @name:		name of the cache
  *
@@ -1773,8 +1772,7 @@ __setup("slub_debug", setup_slub_debug);
  * slub_debug=<Debug-Options>,<slab name1>,<slab name2> ...
  * then only the select slabs will receive the debug option(s).
  */
-slab_flags_t kmem_cache_flags(unsigned int object_size,
-	slab_flags_t flags, const char *name)
+slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name)
 {
 	char *iter;
 	size_t len;
@@ -1850,8 +1848,7 @@ static inline void add_full(struct kmem_cache *s, struct kmem_cache_node *n,
 					struct slab *slab) {}
 static inline void remove_full(struct kmem_cache *s, struct kmem_cache_node *n,
 					struct slab *slab) {}
-slab_flags_t kmem_cache_flags(unsigned int object_size,
-	slab_flags_t flags, const char *name)
+slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name)
 {
 	return flags;
 }
@@ -5104,7 +5101,7 @@ static int calculate_sizes(struct kmem_cache *s)
 
 static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags)
 {
-	s->flags = kmem_cache_flags(s->size, flags, s->name);
+	s->flags = kmem_cache_flags(flags, s->name);
 #ifdef CONFIG_SLAB_FREELIST_HARDENED
 	s->random = get_random_long();
 #endif

-- 
b4 0.10.1


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

* [PATCH 2/2] mm, slab: fix the comment
  2024-02-21 12:12 [PATCH 0/2] mm, slab: two minor cleanups Chengming Zhou
  2024-02-21 12:12 ` [PATCH 1/2] mm, slab: remove unused object_size parameter in kmem_cache_flags() Chengming Zhou
@ 2024-02-21 12:12 ` Chengming Zhou
  2024-02-21 15:23 ` [PATCH 0/2] mm, slab: two minor cleanups Vlastimil Babka
  2 siblings, 0 replies; 4+ messages in thread
From: Chengming Zhou @ 2024-02-21 12:12 UTC (permalink / raw)
  To: Pekka Enberg, Joonsoo Kim, Andrew Morton, David Rientjes,
	Christoph Lameter, Hyeonggon Yoo, Vlastimil Babka,
	Roman Gushchin
  Cc: Chengming Zhou, linux-mm, linux-kernel

The partial slabs on cpu partial list are not frozen after the commit
8cd3fa428b56 ("slub: Delay freezing of partial slabs") merged. So fix
the comment.

Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 95700f2b17ae..d5ca58e65053 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -391,7 +391,7 @@ struct kmem_cache_cpu {
 	};
 	struct slab *slab;	/* The slab from which we are allocating */
 #ifdef CONFIG_SLUB_CPU_PARTIAL
-	struct slab *partial;	/* Partially allocated frozen slabs */
+	struct slab *partial;	/* Partially allocated slabs */
 #endif
 	local_lock_t lock;	/* Protects the fields above */
 #ifdef CONFIG_SLUB_STATS

-- 
b4 0.10.1


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

* Re: [PATCH 0/2] mm, slab: two minor cleanups
  2024-02-21 12:12 [PATCH 0/2] mm, slab: two minor cleanups Chengming Zhou
  2024-02-21 12:12 ` [PATCH 1/2] mm, slab: remove unused object_size parameter in kmem_cache_flags() Chengming Zhou
  2024-02-21 12:12 ` [PATCH 2/2] mm, slab: fix the comment Chengming Zhou
@ 2024-02-21 15:23 ` Vlastimil Babka
  2 siblings, 0 replies; 4+ messages in thread
From: Vlastimil Babka @ 2024-02-21 15:23 UTC (permalink / raw)
  To: Chengming Zhou, Pekka Enberg, Joonsoo Kim, Andrew Morton,
	David Rientjes, Christoph Lameter, Hyeonggon Yoo, Roman Gushchin
  Cc: linux-mm, linux-kernel

On 2/21/24 13:12, Chengming Zhou wrote:
> Just two minor cleanups when reviewing the code.

Merged for 6.9, thanks.

> Thanks!
> 
> Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
> ---
> Chengming Zhou (2):
>       mm, slab: remove unused object_size parameter in kmem_cache_flags()
>       mm, slab: fix the comment

	made this subject more specific:
mm, slab: fix the comment of cpu partial list

> 
>  mm/slab.h        |  3 +--
>  mm/slab_common.c |  2 +-
>  mm/slub.c        | 11 ++++-------
>  3 files changed, 6 insertions(+), 10 deletions(-)
> ---
> base-commit: c09a8e005eff6c064e2e9f11549966c36a724fbf
> change-id: 20240221-slab-cleanup-df9652186012
> 
> Best regards,



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

end of thread, other threads:[~2024-02-21 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 12:12 [PATCH 0/2] mm, slab: two minor cleanups Chengming Zhou
2024-02-21 12:12 ` [PATCH 1/2] mm, slab: remove unused object_size parameter in kmem_cache_flags() Chengming Zhou
2024-02-21 12:12 ` [PATCH 2/2] mm, slab: fix the comment Chengming Zhou
2024-02-21 15:23 ` [PATCH 0/2] mm, slab: two minor cleanups Vlastimil Babka

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