Re: [PATCH 2/3] sbitmap: ammortize cost of clearing bits
From: Jens Axboe <axboe@kernel.dk>
Date: 2018-12-09 06:20:04
Also in:
lkml
On Dec 8, 2018, at 10:51 PM, Guenter Roeck [off-list ref] wrote:
Hi,quoted
On Thu, Nov 29, 2018 at 06:12:33PM -0700, Jens Axboe wrote: sbitmap maintains a set of words that we use to set and clear bits, with each bit representing a tag for blk-mq. Even though we spread the bits out and maintain a hint cache, one particular bit allocated will end up being cleared in the exact same spot. This introduces batched clearing of bits. Instead of clearing a given bit, the same bit is set in a cleared/free mask instead. If we fail allocating a bit from a given word, then we check the free mask, and batch move those cleared bits at that time. This trades 64 atomic bitops for 2 cmpxchg(). In a threaded poll test case, half the overhead of getting and clearing tags is removed with this change. On another poll test case with a single thread, performance is unchanged. Signed-off-by: Jens Axboe <axboe@kernel.dk>This patch results in irq lock inversion warnings when trying to boot from usb drives. This was observed with qemu boots of aarch64, x86, and x86_64 images.
This one is a false positive, was already reported last week. Just need to add some lockdep annotation for it.