Commit 119d1cbc authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull slab fix from Vlastimil Babka:

 - A stable fix for kmalloc_nolock() in non-preemptible contexts on
   PREEMPT_RT (Swaraj Gaikwad)

* tag 'slab-for-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
  slab: fix kmalloc_nolock() context check for PREEMPT_RT
parents 07eebd93 99a3e3a1
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5694,8 +5694,12 @@ void *kmalloc_nolock_noprof(size_t size, gfp_t gfp_flags, int node)
	if (unlikely(!size))
		return ZERO_SIZE_PTR;

	if (IS_ENABLED(CONFIG_PREEMPT_RT) && (in_nmi() || in_hardirq()))
		/* kmalloc_nolock() in PREEMPT_RT is not supported from irq */
	if (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible())
		/*
		 * kmalloc_nolock() in PREEMPT_RT is not supported from
		 * non-preemptible context because local_lock becomes a
		 * sleeping lock on RT.
		 */
		return NULL;
retry:
	if (unlikely(size > KMALLOC_MAX_CACHE_SIZE))