Skip to content

Commit 119d1cb

Browse files
committed
Merge tag 'slab-for-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
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
2 parents 07eebd9 + 99a3e3a commit 119d1cb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

mm/slub.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5694,8 +5694,12 @@ void *kmalloc_nolock_noprof(size_t size, gfp_t gfp_flags, int node)
56945694
if (unlikely(!size))
56955695
return ZERO_SIZE_PTR;
56965696

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

0 commit comments

Comments
 (0)