HomeFreeBSD

Linux: Never sleep in kmem_cache_alloc(..., KM_NOSLEEP) (#14926)

Description

Linux: Never sleep in kmem_cache_alloc(..., KM_NOSLEEP) (#14926)

When a kmem cache is exhausted and needs to be expanded a new
slab is allocated. KM_SLEEP callers can block and wait for the
allocation, but KM_NOSLEEP callers were incorrectly allowed to
block as well.

Resolve this by attempting an emergency allocation as a best
effort. This may fail but that's fine since any KM_NOSLEEP
consumer is required to handle an allocation failure.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Adam Moss <c@yotes.com>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Jun 7 2023, 5:43 PM
Tony Hutter <hutter2@llnl.gov>Committed on Sep 11 2023, 10:17 PM
Parents
rG426d07d64c00: quick fix for lingering snapdir unmount problems
Branches
Unknown
Tags
Unknown

Event Timeline

Tony Hutter <hutter2@llnl.gov> committed rG837e426c1f30: Linux: Never sleep in kmem_cache_alloc(..., KM_NOSLEEP) (#14926) (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Sep 11 2023, 10:17 PM