Commit 37198768 authored by Steven Rostedt (VMware)'s avatar Steven Rostedt (VMware) Committed by Linus Torvalds
Browse files

sbitmap: Protect swap_lock from softirqs

The swap_lock used by sbitmap has a chain with locks taken from softirq,
but the swap_lock is not protected from being preempted by softirqs.

A chain exists of:

 sbq->ws[i].wait -> dispatch_wait_lock -> swap_lock

Where the sbq->ws[i].wait lock can be taken from softirq context, which
means all locks below it in the chain must also be protected from
Reported-by: default avatarClark Williams <>
Fixes: 58ab5e32 ("sbitmap: silence bogus lockdep IRQ warning")
Fixes: ea86ea2c

 ("sbitmap: amortize cost of clearing bits")
Cc: Jens Axboe <>
Cc: Ming Lei <>
Cc: Guenter Roeck <>
Signed-off-by: default avatarSteven Rostedt (VMware) <>
Signed-off-by: default avatarLinus Torvalds <>
parent c962cb32
......@@ -26,14 +26,9 @@
static inline bool sbitmap_deferred_clear(struct sbitmap *sb, int index)
unsigned long mask, val;
unsigned long __maybe_unused flags;
bool ret = false;
/* Silence bogus lockdep warning */
#if defined(CONFIG_LOCKDEP)
if (!sb->map[index].cleared)
goto out_unlock;
......@@ -54,10 +49,7 @@ static inline bool sbitmap_deferred_clear(struct sbitmap *sb, int index)
ret = true;
#if defined(CONFIG_LOCKDEP)
return ret;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment