Skip to content

scsi: core: avoid big pre-allocation for sg list

Ming Lei linux-block linux-nvme linux-scsi netdev 2 versions – Applied

Status from this message: Applied to 5.3/scsi-queue with some clarifications to the commit

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 11 repliesApplied
  2. v33 patches 5 repliesSuperseded

Changes in v4 from the cover letter

- add parameter to sg_alloc_table_chained()/sg_free_table_chained() directly, and update current callers

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3lib/sg_pool.c: improve APIs for allocating sg pooldrivers/nvme/host/fc.c drivers/nvme/host/rdma.c drivers/nvme/target/loop.c +5 more+76 -411 reply
2/3scsi: core: avoid to pre-allocate big chunk for protection meta datadrivers/scsi/scsi_lib.c+11 -31 reply
3/3scsi: core: avoid to pre-allocate big chunk for sg listdrivers/scsi/scsi_lib.c+9 -67 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigBart Van Assche
1/3R-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH V4 0/3] scsi: core: avoid big pre-allocation for sg list

Hi,

Since supporting to blk-mq, big pre-allocation for sg list is introduced, this way is very unfriendly wrt. memory consumption.

There were Red Hat internal reports that some scsi_debug based tests can't be run any more because of too big pre-allocation.

Also lpfc users commplained that 1GB+ ram is pre-allocatd for single HBA.

sg_alloc_table_chained() is improved to support variant size of 1st pre-allocated SGL in the 1st patch as suggested by Christoph.

The other two patches try to address this issue by allocating sg list runtime, meantime pre-allocating one or two inline sg entries for small IO. This ways follows NVMe's approach wrt. sg list allocation.

V4:
- add parameter to sg_alloc_table_chained()/sg_free_table_chained() directly, and update current callers

V3:
- improve sg_alloc_table_chained() to accept variant size of the 1st pre-allocated SGL
- applies the improved sg API to address the big pre-allocation issue

V2:
- move inline sg table initializetion into one helper
- introduce new helper for getting inline sg
- comment log fix

Ming Lei (3):
lib/sg_pool.c: improve APIs for allocating sg pool
scsi: core: avoid to pre-allocate big chunk for protection meta data
scsi: core: avoid to pre-allocate big chunk for sg list

 drivers/nvme/host/fc.c            |  7 ++++---
 drivers/nvme/host/rdma.c          |  7 ++++---
 drivers/nvme/target/loop.c        |  4 ++--
 drivers/scsi/scsi_lib.c           | 31 ++++++++++++++++++++++---------
 include/linux/scatterlist.h       | 11 +++++++----
 lib/scatterlist.c                 | 36 +++++++++++++++++++++++-------------
 lib/sg_pool.c                     | 37 +++++++++++++++++++++++++++----------
 net/sunrpc/xprtrdma/svc_rdma_rw.c |  5 +++--
 8 files changed, 92 insertions(+), 46 deletions(-)
Cc Christoph Hellwig <hch at lst.de>
Cc Bart Van Assche <bvanassche at acm.org>
Cc Ewan D. Milne <emilne at redhat.com>
Cc Hannes Reinecke <hare at suse.com>
Cc Sagi Grimberg <sagi at grimberg.me>
Cc Chuck Lever <chuck.lever at oracle.com>
Cc netdev at vger.kernel.org
Cc linux-nvme at lists.infradead.org
Signature · 1 line
2.9.5