Skip to content

Commit c0f81a9

Browse files
JSYoo5Btehcaster
authored andcommitted
mm/slub: remove unused parameter in setup_object*()
setup_object_debug() and setup_object() has unused parameter, "struct slab *slab". Remove it. By the commit 3ec0974 ("SLUB: Simplify debug code"), setup_object_debug() were introduced to refactor previous code blocks in the setup_object(). Previous code used SlabDebug() to init_object() and init_tracking(). As the SlabDebug() takes "struct page *page" as argument, the setup_object_debug() checks flag of "struct kmem_cache *s" which doesn't require "struct page *page". As the struct page were changed into struct slab by commit bb192ed ("mm/slub: Convert most struct page to struct slab by spatch"), but it's still unused parameter. Suggested-by: Ohhoon Kwon <[email protected]> Signed-off-by: JaeSang Yoo <[email protected]> Acked-by: David Rientjes <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a8f23dd commit c0f81a9

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

mm/slub.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,7 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node, int objects)
12681268
}
12691269

12701270
/* Object debug checks for alloc/free paths */
1271-
static void setup_object_debug(struct kmem_cache *s, struct slab *slab,
1272-
void *object)
1271+
static void setup_object_debug(struct kmem_cache *s, void *object)
12731272
{
12741273
if (!kmem_cache_debug_flags(s, SLAB_STORE_USER|SLAB_RED_ZONE|__OBJECT_POISON))
12751274
return;
@@ -1631,8 +1630,7 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,
16311630
return flags | slub_debug_local;
16321631
}
16331632
#else /* !CONFIG_SLUB_DEBUG */
1634-
static inline void setup_object_debug(struct kmem_cache *s,
1635-
struct slab *slab, void *object) {}
1633+
static inline void setup_object_debug(struct kmem_cache *s, void *object) {}
16361634
static inline
16371635
void setup_slab_debug(struct kmem_cache *s, struct slab *slab, void *addr) {}
16381636

@@ -1775,10 +1773,9 @@ static inline bool slab_free_freelist_hook(struct kmem_cache *s,
17751773
return *head != NULL;
17761774
}
17771775

1778-
static void *setup_object(struct kmem_cache *s, struct slab *slab,
1779-
void *object)
1776+
static void *setup_object(struct kmem_cache *s, void *object)
17801777
{
1781-
setup_object_debug(s, slab, object);
1778+
setup_object_debug(s, object);
17821779
object = kasan_init_slab_obj(s, object);
17831780
if (unlikely(s->ctor)) {
17841781
kasan_unpoison_object_data(s, object);
@@ -1897,13 +1894,13 @@ static bool shuffle_freelist(struct kmem_cache *s, struct slab *slab)
18971894
/* First entry is used as the base of the freelist */
18981895
cur = next_freelist_entry(s, slab, &pos, start, page_limit,
18991896
freelist_count);
1900-
cur = setup_object(s, slab, cur);
1897+
cur = setup_object(s, cur);
19011898
slab->freelist = cur;
19021899

19031900
for (idx = 1; idx < slab->objects; idx++) {
19041901
next = next_freelist_entry(s, slab, &pos, start, page_limit,
19051902
freelist_count);
1906-
next = setup_object(s, slab, next);
1903+
next = setup_object(s, next);
19071904
set_freepointer(s, cur, next);
19081905
cur = next;
19091906
}
@@ -1974,11 +1971,11 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
19741971

19751972
if (!shuffle) {
19761973
start = fixup_red_left(s, start);
1977-
start = setup_object(s, slab, start);
1974+
start = setup_object(s, start);
19781975
slab->freelist = start;
19791976
for (idx = 0, p = start; idx < slab->objects - 1; idx++) {
19801977
next = p + s->size;
1981-
next = setup_object(s, slab, next);
1978+
next = setup_object(s, next);
19821979
set_freepointer(s, p, next);
19831980
p = next;
19841981
}

0 commit comments

Comments
 (0)