Commit f6db358d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents ec714e37 f7dfa0f3
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -2152,6 +2152,7 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
		return 0;
	}

	if (allow_spin)
		kmemleak_not_leak(vec);
	return 0;
}
@@ -6431,17 +6432,24 @@ static void free_deferred_objects(struct irq_work *work)

static void defer_free(struct kmem_cache *s, void *head)
{
	struct defer_free *df = this_cpu_ptr(&defer_free_objects);
	struct defer_free *df;

	guard(preempt)();

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

static void defer_deactivate_slab(struct slab *slab, void *flush_freelist)
{
	struct defer_free *df = this_cpu_ptr(&defer_free_objects);
	struct defer_free *df;

	slab->flush_freelist = flush_freelist;

	guard(preempt)();

	df = this_cpu_ptr(&defer_free_objects);
	if (llist_add(&slab->llnode, &df->slabs))
		irq_work_queue(&df->work);
}
@@ -7693,6 +7701,7 @@ void __kmem_cache_release(struct kmem_cache *s)
		pcs_destroy(s);
#ifndef CONFIG_SLUB_TINY
#ifdef CONFIG_PREEMPT_RT
	if (s->cpu_slab)
		lockdep_unregister_key(&s->lock_key);
#endif
	free_percpu(s->cpu_slab);