Skip to content

fix lockdep warnings with kmalloc_nolock()

Harry Yoo linux-mm stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v12 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Patch 1: per Vlastimil's suggestion, do not access current->mems_allowed_seq and avoid retry if !allow_spin, rather than returning NULL.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/slab: do not access current->mems_allowed_seq if !allow_spinmm/slub.c+11 -20 replies
2/2mm/slab: use prandom if !allow_spinmm/slub.c+24 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH V2 0/2] fix lockdep warnings with kmalloc_nolock()

Hi, I've observed two lockdep warnings while testing kmalloc_nolock() in NMI:

1. Accessing current->mems_allowed_seq seqlock in NMI isn't safe and lockdep complains.

2. w/ CONFIG_SLAB_FREELIST_RANDOM, get_random_u32() acquires a local_lock, which isn't safe in NMI and could cause a deadlock.

Let's fix them.

Note: This is based on the latest slab/for-next. It wasn't clear to me if I should base it on slab/for-next or slab/for-next-fixes, because the merge window has started, this series needs some exposure in -next, and the patches in slab/for-next might land in mainline in the meantime.

But the conflict resolution should be trivial even if it should have been based on slab/for-next-fixes.

v1 -> v2:
- Patch 1: per Vlastimil's suggestion, do not access current->mems_allowed_seq and avoid retry if !allow_spin, rather than returning NULL.

v1: https://lore.kernel.org/linux-mm/[email protected]

Harry Yoo (2):
mm/slab: do not access current->mems_allowed_seq if !allow_spin mm/slab: use prandom if !allow_spin

 mm/slub.c | 41 +++++++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

base-commit: f6ed7e47c1fc78e78c9bfeb668b1ad9ba5c58120

Signature · 1 line
2.43.0