Skip to content

Commit 59a0991

Browse files
Christoph Lameterpenberg
authored andcommitted
slub: Use correct cpu_slab on dead cpu
Pass a kmem_cache_cpu pointer into unfreeze partials so that a different kmem_cache_cpu structure than the local one can be specified. Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
1 parent a755b76 commit 59a0991

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

mm/slub.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,12 +1869,14 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, void *freel
18691869
/*
18701870
* Unfreeze all the cpu partial slabs.
18711871
*
1872-
* This function must be called with interrupt disabled.
1872+
* This function must be called with interrupts disabled
1873+
* for the cpu using c (or some other guarantee must be there
1874+
* to guarantee no concurrent accesses).
18731875
*/
1874-
static void unfreeze_partials(struct kmem_cache *s)
1876+
static void unfreeze_partials(struct kmem_cache *s,
1877+
struct kmem_cache_cpu *c)
18751878
{
18761879
struct kmem_cache_node *n = NULL, *n2 = NULL;
1877-
struct kmem_cache_cpu *c = this_cpu_ptr(s->cpu_slab);
18781880
struct page *page, *discard_page = NULL;
18791881

18801882
while ((page = c->partial)) {
@@ -1960,7 +1962,7 @@ static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
19601962
* set to the per node partial list.
19611963
*/
19621964
local_irq_save(flags);
1963-
unfreeze_partials(s);
1965+
unfreeze_partials(s, this_cpu_ptr(s->cpu_slab));
19641966
local_irq_restore(flags);
19651967
oldpage = NULL;
19661968
pobjects = 0;
@@ -2003,7 +2005,7 @@ static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu)
20032005
if (c->page)
20042006
flush_slab(s, c);
20052007

2006-
unfreeze_partials(s);
2008+
unfreeze_partials(s, c);
20072009
}
20082010
}
20092011

0 commit comments

Comments
 (0)