1
0
Fork 0
alistair23-linux/drivers/nvme/host
Ming Lei 4635873c56 scsi: lib/sg_pool.c: improve APIs for allocating sg pool
sg_alloc_table_chained() currently allows the caller to provide one
preallocated SGL and returns if the requested number isn't bigger than
size of that SGL. This is used to inline an SGL for an IO request.

However, scattergather code only allows that size of the 1st preallocated
SGL to be SG_CHUNK_SIZE(128). This means a substantial amount of memory
(4KB) is claimed for the SGL for each IO request. If the I/O is small, it
would be prudent to allocate a smaller SGL.

Introduce an extra parameter to sg_alloc_table_chained() and
sg_free_table_chained() for specifying size of the preallocated SGL.

Both __sg_free_table() and __sg_alloc_table() assume that each SGL has the
same size except for the last one.  Change the code to allow both functions
to accept a variable size for the 1st preallocated SGL.

[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>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: netdev@vger.kernel.org
Cc: linux-nvme@lists.infradead.org
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-06-20 15:21:33 -04:00
..
Kconfig nvme-tcp: add NVMe over TCP host driver 2018-12-13 09:58:58 +01:00
Makefile nvme-tcp: add NVMe over TCP host driver 2018-12-13 09:58:58 +01:00
core.c for-5.2/block-post-20190516 2019-05-16 19:08:15 -07:00
fabrics.c nvme-fabrics: remove unused argument 2019-05-14 17:19:43 +02:00
fabrics.h nvme-fabrics: convert to SPDX identifiers 2019-02-20 07:22:13 -07:00
fault_inject.c nvme: convert to SPDX identifiers 2019-02-20 07:22:28 -07:00
fc.c scsi: lib/sg_pool.c: improve APIs for allocating sg pool 2019-06-20 15:21:33 -04:00
lightnvm.c lightnvm: Inherit mdts from the parent nvme device 2019-05-06 10:19:17 -06:00
multipath.c nvme-multipath: avoid crash on invalid subsystem cntlid enumeration 2019-05-13 16:00:03 +02:00
nvme.h nvme: mark nvme_core_init and nvme_core_exit static 2019-05-01 09:18:47 -04:00
pci.c nvme-pci: mark expected switch fall-through 2019-05-13 16:00:03 +02:00
rdma.c scsi: lib/sg_pool.c: improve APIs for allocating sg pool 2019-06-20 15:21:33 -04:00
tcp.c nvme-tcp: fix possible null deref on a timed out io queue connect 2019-05-01 09:17:15 -04:00
trace.c nvme: add get-feature to admin cmds tracer 2019-03-13 12:05:39 -06:00
trace.h nvme: trace all async notice events 2019-05-14 17:19:47 +02:00