Skip to content

Commit 32cf9f2

Browse files
committed
slab: use struct freelist_counters for local variables instead of struct slab
In several functions we declare local struct slab variables so we can work with the freelist and counters fields (including the sub-counters that are in the union) comfortably. With struct freelist_counters containing the full counters definition, we can now reduce the local variables to that type as we don't need the other fields in struct slab. Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 3993ca9 commit 32cf9f2

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

mm/slub.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3725,8 +3725,7 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab,
37253725
void *nextfree, *freelist_iter, *freelist_tail;
37263726
int tail = DEACTIVATE_TO_HEAD;
37273727
unsigned long flags = 0;
3728-
struct slab new;
3729-
struct slab old;
3728+
struct freelist_counters old, new;
37303729

37313730
if (READ_ONCE(slab->freelist)) {
37323731
stat(s, DEACTIVATE_REMOTE_FREES);
@@ -4390,7 +4389,7 @@ __update_cpu_freelist_fast(struct kmem_cache *s,
43904389
*/
43914390
static inline void *get_freelist(struct kmem_cache *s, struct slab *slab)
43924391
{
4393-
struct slab new;
4392+
struct freelist_counters new;
43944393
unsigned long counters;
43954394
void *freelist;
43964395

@@ -4418,7 +4417,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct slab *slab)
44184417
*/
44194418
static inline void *freeze_slab(struct kmem_cache *s, struct slab *slab)
44204419
{
4421-
struct slab new;
4420+
struct freelist_counters new;
44224421
unsigned long counters;
44234422
void *freelist;
44244423

@@ -5867,7 +5866,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
58675866
{
58685867
void *old_head;
58695868
bool was_frozen, was_full;
5870-
struct slab new;
5869+
struct freelist_counters new;
58715870
unsigned long counters;
58725871
struct kmem_cache_node *n = NULL;
58735872
unsigned long flags;

0 commit comments

Comments
 (0)