mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
slub: Introduce freeze_slab()
We will have unfrozen slabs out of the node partial list later, so we need a freeze_slab() function to freeze the partial slab and get its freelist. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
422e7d5437
commit
213094b5d1
27
mm/slub.c
27
mm/slub.c
@ -3098,6 +3098,33 @@ static inline void *get_freelist(struct kmem_cache *s, struct slab *slab)
|
||||
return freelist;
|
||||
}
|
||||
|
||||
/*
|
||||
* Freeze the partial slab and return the pointer to the freelist.
|
||||
*/
|
||||
static inline void *freeze_slab(struct kmem_cache *s, struct slab *slab)
|
||||
{
|
||||
struct slab new;
|
||||
unsigned long counters;
|
||||
void *freelist;
|
||||
|
||||
do {
|
||||
freelist = slab->freelist;
|
||||
counters = slab->counters;
|
||||
|
||||
new.counters = counters;
|
||||
VM_BUG_ON(new.frozen);
|
||||
|
||||
new.inuse = slab->objects;
|
||||
new.frozen = 1;
|
||||
|
||||
} while (!slab_update_freelist(s, slab,
|
||||
freelist, counters,
|
||||
NULL, new.counters,
|
||||
"freeze_slab"));
|
||||
|
||||
return freelist;
|
||||
}
|
||||
|
||||
/*
|
||||
* Slow path. The lockless freelist is empty or we need to perform
|
||||
* debugging duties.
|
||||
|
Loading…
Reference in New Issue
Block a user