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
GitHub <noreply@github.com>Committed on Jun 7 2023, 5:43 PM
Parents
rGbcd5321039c3: Fix the L2ARC write size calculating logic
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG93f8abeff08e: Linux: Never sleep in kmem_cache_alloc(..., KM_NOSLEEP) (#14926) (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Jun 7 2023, 5:43 PM