mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
vhost-scsi: Allocate T10 PI structs only when enabled
T10 PI is not a widely used feature. This has us only allocate the structs for it if the feature has been enabled. For a common small setup where you have 1 virtqueue and 128 commands per queue, this saves: 8MB = 32 bytes per sg * 2048 entries * 128 commands per vhost-scsi device. Signed-off-by: Mike Christie <michael.christie@oracle.com> Message-Id: <20241203191705.19431-3-michael.christie@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
4c1f3a7d74
commit
bf2d650391
@@ -1651,12 +1651,14 @@ static int vhost_scsi_setup_vq_cmds(struct vhost_virtqueue *vq, int max_cmds)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
tv_cmd->tvc_prot_sgl = kcalloc(VHOST_SCSI_PREALLOC_PROT_SGLS,
|
if (vhost_has_feature(vq, VIRTIO_SCSI_F_T10_PI)) {
|
||||||
sizeof(struct scatterlist),
|
tv_cmd->tvc_prot_sgl = kcalloc(VHOST_SCSI_PREALLOC_PROT_SGLS,
|
||||||
GFP_KERNEL);
|
sizeof(struct scatterlist),
|
||||||
if (!tv_cmd->tvc_prot_sgl) {
|
GFP_KERNEL);
|
||||||
pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n");
|
if (!tv_cmd->tvc_prot_sgl) {
|
||||||
goto out;
|
pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user