Skip to content

Commit c5c4490

Browse files
Matthew Wilcox (Oracle)tehcaster
authored andcommitted
slab: Add SL_partial flag
Give slab its own name for this flag. Keep the PG_workingset alias information in one place. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Acked-by: Harry Yoo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 3090809 commit c5c4490

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

mm/slub.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@
9191
* The partially empty slabs cached on the CPU partial list are used
9292
* for performance reasons, which speeds up the allocation process.
9393
* These slabs are not frozen, but are also exempt from list management,
94-
* by clearing the PG_workingset flag when moving out of the node
94+
* by clearing the SL_partial flag when moving out of the node
9595
* partial list. Please see __slab_free() for more details.
9696
*
9797
* To sum up, the current scheme is:
98-
* - node partial slab: PG_Workingset && !frozen
99-
* - cpu partial slab: !PG_Workingset && !frozen
100-
* - cpu slab: !PG_Workingset && frozen
101-
* - full slab: !PG_Workingset && !frozen
98+
* - node partial slab: SL_partial && !frozen
99+
* - cpu partial slab: !SL_partial && !frozen
100+
* - cpu slab: !SL_partial && frozen
101+
* - full slab: !SL_partial && !frozen
102102
*
103103
* list_lock
104104
*
@@ -186,13 +186,15 @@
186186
/**
187187
* enum slab_flags - How the slab flags bits are used.
188188
* @SL_locked: Is locked with slab_lock()
189+
* @SL_partial: On the per-node partial list
189190
*
190191
* The slab flags share space with the page flags but some bits have
191192
* different interpretations. The high bits are used for information
192193
* like zone/node/section.
193194
*/
194195
enum slab_flags {
195196
SL_locked = PG_locked,
197+
SL_partial = PG_workingset, /* Historical reasons for this bit */
196198
};
197199

198200
/*
@@ -2729,23 +2731,19 @@ static void discard_slab(struct kmem_cache *s, struct slab *slab)
27292731
free_slab(s, slab);
27302732
}
27312733

2732-
/*
2733-
* SLUB reuses PG_workingset bit to keep track of whether it's on
2734-
* the per-node partial list.
2735-
*/
27362734
static inline bool slab_test_node_partial(const struct slab *slab)
27372735
{
2738-
return folio_test_workingset(slab_folio(slab));
2736+
return test_bit(SL_partial, &slab->flags);
27392737
}
27402738

27412739
static inline void slab_set_node_partial(struct slab *slab)
27422740
{
2743-
set_bit(PG_workingset, folio_flags(slab_folio(slab), 0));
2741+
set_bit(SL_partial, &slab->flags);
27442742
}
27452743

27462744
static inline void slab_clear_node_partial(struct slab *slab)
27472745
{
2748-
clear_bit(PG_workingset, folio_flags(slab_folio(slab), 0));
2746+
clear_bit(SL_partial, &slab->flags);
27492747
}
27502748

27512749
/*

0 commit comments

Comments
 (0)