nvme: only use power of two io boundaries
Keith Busch
maintainerPATCH 1/1 nvme: only use power of two io boundaries
The kernel requires a power of two for boundaries because that's the only way it can efficiently split commands that cross them. A controller, however, may report a non-power of two boundary.
The driver had been rounding the controller's value to one the kernel can use, but splitting on the wrong boundary provides no benefit on the device side, and actually incurs additional submission overhead from non-optimal splits. Don't provide any boundary hint if the controller's value can't be used.
--- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +2 -2
@@ -2097,8 +2097,8 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) } } -if (iob && !blk_queue_is_zoned (ns->queue)) -blk_queue_chunk_sectors (ns->queue,rounddown_pow_of_two (iob)); +if (is_power_of_2 (iob) && !blk_queue_is_zoned (ns->queue)) +blk_queue_chunk_sectors (ns->queue, iob);nvme_update_disk_info (disk, ns, id);#ifdef CONFIG_NVME_MULTIPATH if (ns->head->disk) {
Signature · 7 lines
2.24.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
maintainerQuoted 9 lines · Keith Busch
The kernel requires a power of two for boundaries because that's the only way it can efficiently split commands that cross them. A controller, however, may report a non-power of two boundary.
The driver had been rounding the controller's value to one the kernel can use, but splitting on the wrong boundary provides no benefit on the device side, and actually incurs additional submission overhead from non-optimal splits. Don't provide any boundary hint if the controller's value can't be used.
Shouldn't we log a warning about non-power of two sizes?
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerQuoted 5 lines · Christoph Hellwig
Quoted 4 lines · Keith Busch
The kernel requires a power of two for boundaries because that's the only way it can efficiently split commands that cross them. A controller, however, may report a non-power of two boundary.
Quoted 7 lines
Quoted 5 lines
The driver had been rounding the controller's value to one the kernel can use, but splitting on the wrong boundary provides no benefit on the device side, and actually incurs additional submission overhead from non-optimal splits. Don't provide any boundary hint if the controller's value can't be used.
Shouldn't we log a warning about non-power of two sizes?
Sure, this would provide an explanation for unexpectedly lower performance. That's worthy of a warning, so sending a v2.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme