Commit 3dccdf5
scsi: core: avoid preallocating big SGL for data
scsi_mq_setup_tags() preallocates a big buffer for the IO SGL. The size is
based on scsi_mq_sgl_size() which is determined based on
shost->sg_tablesize and SG_CHUNK_SIZE.
Modern DMA engines are often capable of dealing with very big segments so
the resulting scsi_mq_sgl_size() is often too big. SG_CHUNK_SIZE results in
a static 4KB SGL allocation per command.
If an HBA has lots of deep queues, preallocation for the sg list can
consume substantial amounts of memory. For lpfc, nr_hw_queues can be 70
and each queue's depth 3781. This means the resulting preallocation for
the data SGL is 70*3781*2K = 517MB.
Switch to runtime allocation for SGL for lists longer than 2 entries. This
is the approach used by NVMe PCI so it should be reasonable for SCSI as
well. Runtime SGL allocation has always been the case for the legacy I/O
path so this is nothing new.
[mkp: attempted to clarify commit desc]
Cc: Christoph Hellwig <hch@lst.de>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Ewan D. Milne <emilne@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 92524fa commit 3dccdf5
1 file changed
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
547 | 549 | | |
548 | 550 | | |
549 | 551 | | |
550 | | - | |
| 552 | + | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| |||
984 | 987 | | |
985 | 988 | | |
986 | 989 | | |
987 | | - | |
| 990 | + | |
988 | 991 | | |
989 | 992 | | |
990 | 993 | | |
| |||
1550 | 1553 | | |
1551 | 1554 | | |
1552 | 1555 | | |
1553 | | - | |
| 1556 | + | |
1554 | 1557 | | |
1555 | | - | |
| 1558 | + | |
1556 | 1559 | | |
1557 | 1560 | | |
1558 | 1561 | | |
| |||
1734 | 1737 | | |
1735 | 1738 | | |
1736 | 1739 | | |
1737 | | - | |
| 1740 | + | |
1738 | 1741 | | |
1739 | 1742 | | |
1740 | 1743 | | |
| |||
1828 | 1831 | | |
1829 | 1832 | | |
1830 | 1833 | | |
1831 | | - | |
| 1834 | + | |
1832 | 1835 | | |
1833 | 1836 | | |
1834 | 1837 | | |
| |||
0 commit comments