Skip to content

Commit 5e6a7d1

Browse files
hreineckeChristoph Hellwig
authored andcommitted
nvme-multipath: use vmalloc for ANA log buffer
The ANA log buffer can get really large, as it depends on the controller configuration. So to avoid an out-of-memory issue during scanning use kvmalloc() instead of the kmalloc(). Signed-off-by: Hannes Reinecke <hare@suse.de> Tested-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 85d9abc commit 5e6a7d1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/nvme/host/multipath.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/backing-dev.h>
77
#include <linux/moduleparam.h>
8+
#include <linux/vmalloc.h>
89
#include <trace/events/block.h>
910
#include "nvme.h"
1011

@@ -898,7 +899,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
898899
if (ana_log_size > ctrl->ana_log_size) {
899900
nvme_mpath_stop(ctrl);
900901
nvme_mpath_uninit(ctrl);
901-
ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
902+
ctrl->ana_log_buf = kvmalloc(ana_log_size, GFP_KERNEL);
902903
if (!ctrl->ana_log_buf)
903904
return -ENOMEM;
904905
}
@@ -915,7 +916,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
915916

916917
void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
917918
{
918-
kfree(ctrl->ana_log_buf);
919+
kvfree(ctrl->ana_log_buf);
919920
ctrl->ana_log_buf = NULL;
920921
ctrl->ana_log_size = 0;
921922
}

0 commit comments

Comments
 (0)