Skip to content

Commit 08beb54

Browse files
committed
mm, slab: split out the cpu offline variant of flush_slab()
flush_slab() is called either as part IPI handler on given live cpu, or as a cleanup on behalf of another cpu that went offline. The first case needs to protect updating the kmem_cache_cpu fields with disabled irqs. Currently the whole call happens with irqs disabled by the IPI handler, but the following patch will change from IPI to workqueue, and flush_slab() will have to disable irqs (to be replaced with a local lock later) in the critical part. To prepare for this change, replace the call to flush_slab() for the dead cpu handling with an opencoded variant that will not disable irqs nor take a local lock. Suggested-by: Mike Galbraith <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 0e7ac73 commit 08beb54

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mm/slub.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,9 +2511,17 @@ static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c)
25112511
static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu)
25122512
{
25132513
struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu);
2514+
void *freelist = c->freelist;
2515+
struct page *page = c->page;
25142516

2515-
if (c->page)
2516-
flush_slab(s, c);
2517+
c->page = NULL;
2518+
c->freelist = NULL;
2519+
c->tid = next_tid(c->tid);
2520+
2521+
if (page) {
2522+
deactivate_slab(s, page, freelist);
2523+
stat(s, CPUSLAB_FLUSH);
2524+
}
25172525

25182526
unfreeze_partials_cpu(s, c);
25192527
}

0 commit comments

Comments
 (0)