summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2022-03-16 02:27:08 +0100
committerJens Axboe <axboe@kernel.dk>2022-03-22 03:01:34 +0100
commit863a66cdb4df25fd146d9851c3289072298566d5 (patch)
tree44904cf202074da92333cbb546b860248b0c85be /include
parentblock: cancel all throttled bios in del_gendisk() (diff)
downloadlinux-863a66cdb4df25fd146d9851c3289072298566d5.tar.xz
linux-863a66cdb4df25fd146d9851c3289072298566d5.zip
lib/sbitmap: allocate sb->map via kvzalloc_node
sbitmap has been used in scsi for replacing atomic operations on sdev->device_busy, so IOPS on some fast scsi storage can be improved. However, sdev->device_busy can be changed in fast path, so we have to allocate the sb->map statically. sdev->device_busy has been capped to 1024, but some drivers may configure the default depth as < 8, then cause each sbitmap word to hold only one bit. Finally 1024 * 128( sizeof(sbitmap_word)) bytes is needed for sb->map, given it is order 5 allocation, sometimes it may fail. Avoid the issue by using kvzalloc_node() for allocating sb->map. Cc: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20220316012708.354668-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sbitmap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index dffeb8281c2d..8f5a86e210b9 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -174,7 +174,7 @@ static inline unsigned int __map_depth(const struct sbitmap *sb, int index)
static inline void sbitmap_free(struct sbitmap *sb)
{
free_percpu(sb->alloc_hint);
- kfree(sb->map);
+ kvfree(sb->map);
sb->map = NULL;
}