Skip to content

Commit fb016a5

Browse files
committed
mm/slub: remove DEACTIVATE_TO_* stat items
The cpu slabs and their deactivations were removed, so remove the unused stat items. Weirdly enough the values were also used to control __add_partial() adding to head or tail of the list, so replace that with a new enum add_mode, which is cleaner. Reviewed-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Hao Li <hao.li@linux.dev> Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent b16af1c commit fb016a5

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

mm/slub.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ static void debugfs_slab_add(struct kmem_cache *);
329329
static inline void debugfs_slab_add(struct kmem_cache *s) { }
330330
#endif
331331

332+
enum add_mode {
333+
ADD_TO_HEAD,
334+
ADD_TO_TAIL,
335+
};
336+
332337
enum stat_item {
333338
ALLOC_PCS, /* Allocation from percpu sheaf */
334339
ALLOC_FASTPATH, /* Allocation from cpu slab */
@@ -348,8 +353,6 @@ enum stat_item {
348353
CPUSLAB_FLUSH, /* Abandoning of the cpu slab */
349354
DEACTIVATE_FULL, /* Cpu slab was full when deactivated */
350355
DEACTIVATE_EMPTY, /* Cpu slab was empty when deactivated */
351-
DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */
352-
DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
353356
DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
354357
DEACTIVATE_BYPASS, /* Implicit deactivation */
355358
ORDER_FALLBACK, /* Number of times fallback was necessary */
@@ -3270,21 +3273,21 @@ static inline void slab_clear_node_partial(struct slab *slab)
32703273
* Management of partially allocated slabs.
32713274
*/
32723275
static inline void
3273-
__add_partial(struct kmem_cache_node *n, struct slab *slab, int tail)
3276+
__add_partial(struct kmem_cache_node *n, struct slab *slab, enum add_mode mode)
32743277
{
32753278
n->nr_partial++;
3276-
if (tail == DEACTIVATE_TO_TAIL)
3279+
if (mode == ADD_TO_TAIL)
32773280
list_add_tail(&slab->slab_list, &n->partial);
32783281
else
32793282
list_add(&slab->slab_list, &n->partial);
32803283
slab_set_node_partial(slab);
32813284
}
32823285

32833286
static inline void add_partial(struct kmem_cache_node *n,
3284-
struct slab *slab, int tail)
3287+
struct slab *slab, enum add_mode mode)
32853288
{
32863289
lockdep_assert_held(&n->list_lock);
3287-
__add_partial(n, slab, tail);
3290+
__add_partial(n, slab, mode);
32883291
}
32893292

32903293
static inline void remove_partial(struct kmem_cache_node *n,
@@ -3377,7 +3380,7 @@ static void *alloc_single_from_new_slab(struct kmem_cache *s, struct slab *slab,
33773380
if (slab->inuse == slab->objects)
33783381
add_full(s, n, slab);
33793382
else
3380-
add_partial(n, slab, DEACTIVATE_TO_HEAD);
3383+
add_partial(n, slab, ADD_TO_HEAD);
33813384

33823385
inc_slabs_node(s, nid, slab->objects);
33833386
spin_unlock_irqrestore(&n->list_lock, flags);
@@ -3999,7 +4002,7 @@ static unsigned int alloc_from_new_slab(struct kmem_cache *s, struct slab *slab,
39994002
n = get_node(s, slab_nid(slab));
40004003
spin_lock_irqsave(&n->list_lock, flags);
40014004
}
4002-
add_partial(n, slab, DEACTIVATE_TO_HEAD);
4005+
add_partial(n, slab, ADD_TO_HEAD);
40034006
spin_unlock_irqrestore(&n->list_lock, flags);
40044007
}
40054008

@@ -5070,7 +5073,7 @@ static noinline void free_to_partial_list(
50705073
/* was on full list */
50715074
remove_full(s, n, slab);
50725075
if (!slab_free) {
5073-
add_partial(n, slab, DEACTIVATE_TO_TAIL);
5076+
add_partial(n, slab, ADD_TO_TAIL);
50745077
stat(s, FREE_ADD_PARTIAL);
50755078
}
50765079
} else if (slab_free) {
@@ -5190,7 +5193,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
51905193
* then add it.
51915194
*/
51925195
if (unlikely(was_full)) {
5193-
add_partial(n, slab, DEACTIVATE_TO_TAIL);
5196+
add_partial(n, slab, ADD_TO_TAIL);
51945197
stat(s, FREE_ADD_PARTIAL);
51955198
}
51965199
spin_unlock_irqrestore(&n->list_lock, flags);
@@ -6605,7 +6608,7 @@ __refill_objects_node(struct kmem_cache *s, void **p, gfp_t gfp, unsigned int mi
66056608
continue;
66066609

66076610
list_del(&slab->slab_list);
6608-
add_partial(n, slab, DEACTIVATE_TO_HEAD);
6611+
add_partial(n, slab, ADD_TO_HEAD);
66096612
}
66106613

66116614
spin_unlock_irqrestore(&n->list_lock, flags);
@@ -7072,7 +7075,7 @@ static void early_kmem_cache_node_alloc(int node)
70727075
* No locks need to be taken here as it has just been
70737076
* initialized and there is no concurrent access.
70747077
*/
7075-
__add_partial(n, slab, DEACTIVATE_TO_HEAD);
7078+
__add_partial(n, slab, ADD_TO_HEAD);
70767079
}
70777080

70787081
static void free_kmem_cache_nodes(struct kmem_cache *s)
@@ -8764,8 +8767,6 @@ STAT_ATTR(FREE_SLAB, free_slab);
87648767
STAT_ATTR(CPUSLAB_FLUSH, cpuslab_flush);
87658768
STAT_ATTR(DEACTIVATE_FULL, deactivate_full);
87668769
STAT_ATTR(DEACTIVATE_EMPTY, deactivate_empty);
8767-
STAT_ATTR(DEACTIVATE_TO_HEAD, deactivate_to_head);
8768-
STAT_ATTR(DEACTIVATE_TO_TAIL, deactivate_to_tail);
87698770
STAT_ATTR(DEACTIVATE_REMOTE_FREES, deactivate_remote_frees);
87708771
STAT_ATTR(DEACTIVATE_BYPASS, deactivate_bypass);
87718772
STAT_ATTR(ORDER_FALLBACK, order_fallback);
@@ -8868,8 +8869,6 @@ static struct attribute *slab_attrs[] = {
88688869
&cpuslab_flush_attr.attr,
88698870
&deactivate_full_attr.attr,
88708871
&deactivate_empty_attr.attr,
8871-
&deactivate_to_head_attr.attr,
8872-
&deactivate_to_tail_attr.attr,
88738872
&deactivate_remote_frees_attr.attr,
88748873
&deactivate_bypass_attr.attr,
88758874
&order_fallback_attr.attr,

0 commit comments

Comments
 (0)