OpenCloudOS-Kernel/drivers/nvme/target
Fabio M. De Francesco 5bfaba275a nvmet-tcp: don't map pages which can't come from HIGHMEM
kmap() is being deprecated in favor of kmap_local_page().[1]

There are two main problems with kmap(): (1) It comes with an overhead as
mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

The pages which will be mapped are allocated in nvmet_tcp_map_data(),
using the GFP_KERNEL flag. This assures that they cannot come from
HIGHMEM. This imply that a straight page_address() can replace the kmap()
of sg_page(sg) in nvmet_tcp_map_pdu_iovec(). As a side effect, we might
also delete the field "nr_mapped" from struct "nvmet_tcp_cmd" because,
after removing the kmap() calls, there would be no longer any need of it.

In addition, there is no reason to use a kvec for the command receive
data buffers iovec, use a bio_vec instead and let iov_iter handle the
buffer mapping and data copy.

Test with blktests on a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel with
HIGHMEM64GB enabled.

[1] "[PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated
list" https://lore.kernel.org/all/20220813220034.806698-1-ira.weiny@intel.com/

Cc: Chaitanya Kulkarni <chaitanyak@nvidia.com>
Cc: Keith Busch <kbusch@kernel.org>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
[sagi: added bio_vec plus minor naming changes]
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-09-19 17:55:25 +02:00
..
Kconfig nvmet-auth: select the intended CRYPTO_DH_RFC7919_GROUPS 2022-08-02 17:22:51 -06:00
Makefile nvmet: implement basic In-Band Authentication 2022-08-02 17:14:49 -06:00
admin-cmd.c nvme: move from strlcpy with unused retval to strscpy 2022-09-19 11:33:53 +02:00
auth.c nvmet-auth: fix a couple of spelling mistakes 2022-08-02 17:22:51 -06:00
configfs.c nvmet: expose max queues to configfs 2022-09-19 17:55:16 +02:00
core.c nvmet: implement basic In-Band Authentication 2022-08-02 17:14:49 -06:00
discovery.c nvme: move from strlcpy with unused retval to strscpy 2022-09-19 11:33:53 +02:00
fabrics-cmd-auth.c nvmet-auth: remove redundant parameters req 2022-09-19 11:33:54 +02:00
fabrics-cmd.c nvme-auth: remove the redundant req->cqe->result.u16 assignment operation 2022-09-19 11:33:54 +02:00
fc.c nvmet: use a private workqueue instead of the system workqueue 2022-03-29 09:29:04 +02:00
fcloop.c nvmet: use a private workqueue instead of the system workqueue 2022-03-29 09:29:04 +02:00
io-cmd-bdev.c nvmet: avoid unnecessary flush bio 2022-09-19 11:33:54 +02:00
io-cmd-file.c keep iocb_flags() result cached in struct file 2022-06-10 16:10:23 -04:00
loop.c nvme-loop: use nvme core helpers to cancel all requests in a tagset 2022-08-02 17:14:47 -06:00
nvmet.h nvmet-auth: expire authentication sessions 2022-08-02 17:14:50 -06:00
passthru.c nvmet: add a clear_ids attribute for passthru targets 2022-06-30 08:23:24 +02:00
rdma.c RDMA/core: introduce ib_dma_pci_p2p_dma_supported() 2022-07-26 07:28:07 -04:00
tcp.c nvmet-tcp: don't map pages which can't come from HIGHMEM 2022-09-19 17:55:25 +02:00
trace.c nvmet: add set feature tracing support 2021-08-16 14:42:23 +02:00
trace.h nvmet: use min of device_path and disk len 2021-02-10 16:38:05 +01:00
zns.c nvme/target: Use the new blk_opf_t type 2022-07-14 12:14:32 -06:00