[PATCH] Revert "nvme-pci: clamp max_hw_sectors based on DMA optimized limitation"
Hans Holmberg
hans.holmberg at wdc.com
Thu Oct 15 05:49:06 PDT 2026
On 06/10/2026 14:02, Christoph Hellwig wrote:
> This turns down to cause up to 15% performance regressions on standard
> large transfer workloads. Revert it and hope the IOVA allocator can
> eventually be fixed to remove the need for the original workaround.
>
> This reverts commit 3710e2b056cb92ad816e4d79fa54a6a5b6ad8cbd.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> drivers/nvme/host/pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 5440cf18b55b..82e308fe4f4c 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -3747,7 +3747,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
> */
> dev->ctrl.max_hw_sectors = min_t(u32,
> NVME_MAX_BYTES >> SECTOR_SHIFT,
> - dma_opt_mapping_size(&pdev->dev) >> 9);
> + dma_max_mapping_size(&pdev->dev) >> 9);
> dev->ctrl.max_segments = NVME_MAX_SEGS;
> dev->ctrl.max_integrity_segments = 1;
> return dev;
I saw a related problem with the limit capped to dma_opt_mapping_size - this can
cause inflated number of ios in zoned xfs as the max zone append limit is
capped by max_hw_sectors. It can also lead to more extents being generated.
In my case, the drive did not have any limits on appends (mdts: 0 , zasl: 0) but
dma_opt_mapping_size capped that to 128kib which is very small. It would be great
to fix this.
More information about the Linux-nvme
mailing list