Skip to content

Commit f6db358

Browse files
committed
Merge tag 'slab-for-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fixes from Vlastimil Babka: - Fixes for several corner cases in error paths and debugging options, related to the new kmalloc_nolock() functionality (Kuniyuki Iwashima, Ran Xiaokai) * tag 'slab-for-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: slub: Don't call lockdep_unregister_key() for immature kmem_cache. slab: Fix using this_cpu_ptr() in preemptible context slab: Add allow_spin check to eliminate kmemleak warnings
2 parents ec714e3 + f7dfa0f commit f6db358

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

mm/slub.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,8 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
21522152
return 0;
21532153
}
21542154

2155-
kmemleak_not_leak(vec);
2155+
if (allow_spin)
2156+
kmemleak_not_leak(vec);
21562157
return 0;
21572158
}
21582159

@@ -6431,17 +6432,24 @@ static void free_deferred_objects(struct irq_work *work)
64316432

64326433
static void defer_free(struct kmem_cache *s, void *head)
64336434
{
6434-
struct defer_free *df = this_cpu_ptr(&defer_free_objects);
6435+
struct defer_free *df;
6436+
6437+
guard(preempt)();
64356438

6439+
df = this_cpu_ptr(&defer_free_objects);
64366440
if (llist_add(head + s->offset, &df->objects))
64376441
irq_work_queue(&df->work);
64386442
}
64396443

64406444
static void defer_deactivate_slab(struct slab *slab, void *flush_freelist)
64416445
{
6442-
struct defer_free *df = this_cpu_ptr(&defer_free_objects);
6446+
struct defer_free *df;
64436447

64446448
slab->flush_freelist = flush_freelist;
6449+
6450+
guard(preempt)();
6451+
6452+
df = this_cpu_ptr(&defer_free_objects);
64456453
if (llist_add(&slab->llnode, &df->slabs))
64466454
irq_work_queue(&df->work);
64476455
}
@@ -7693,7 +7701,8 @@ void __kmem_cache_release(struct kmem_cache *s)
76937701
pcs_destroy(s);
76947702
#ifndef CONFIG_SLUB_TINY
76957703
#ifdef CONFIG_PREEMPT_RT
7696-
lockdep_unregister_key(&s->lock_key);
7704+
if (s->cpu_slab)
7705+
lockdep_unregister_key(&s->lock_key);
76977706
#endif
76987707
free_percpu(s->cpu_slab);
76997708
#endif

0 commit comments

Comments
 (0)