[PATCH v3 1/1] nvmet-tcp: Don't kmap() pages which can't come from HIGHMEM

Keith Busch kbusch at kernel.org
Fri Aug 26 11:35:09 PDT 2022


On Fri, Aug 26, 2022 at 08:16:59PM +0200, Fabio M. De Francesco wrote:
> On mercoledì 24 agosto 2022 01:32:53 CEST Al Viro wrote:
> > On Mon, Aug 22, 2022 at 04:24:38PM +0200, Fabio M. De Francesco wrote:
> > > Therefore, replace the kmap() of sg_page(sg) with a page_address() and
> > > delete the "nr_mapped" field from "nvmet_tcp_cmd" and instead pass a
> > > local variable to iov_iter_kvec() from the call site in
> > > nvmet_tcp_map_pdu_iovec().
> > 
> > I'd suggest looking into switching to ITER_BVEC...
> 
> Hello Al,
> 
> It's interesting that, for the second time in a few days, I've been suggested 
> to switch to the use of BVEC. Christoph asked for first[1]
> 
> I responded to Christoph and, in the same email, I also asked Sagi
> (the author of nvmet_tcp_map_pdu_iovec()) if he wanted to add something to 
> that discussion.
> 
> As you may have already read, I'm so new to kernel development that I still
> know very little about many subsystems and drivers. I am not currently
> able to tell the difference between BVEC and KVEC. I could probably try to 
> switch from one to the other (after learning from other code), however I won't 
> be able to explain in the commit message why users should better use BVEC in 
> this case.
> 
> My task is to remove as many kmap() call sites I can from the entire kernel, 
> and this is all I did in nvmet-tcp. After doing many tens of call sites 
> removals or conversions to kmap_local_page(), I learned to not go deep into 
> those details which aren't needed to accomplish the task I've been given.
> 
> However, since you and Christoph suggested doing more (I suppose in a separate
> patch), I did some research which seems to confirm that iov_iter_kvec() may be 
> good for what it is supposed to do.
> 
> Since you are talking again about BVEC, soon after Christoph did the same, I'd
> like to understand better which improvements do we expect from BVEC and why
> and when should developers prefer this or KVEC.
> 
> Can you please provide further information or links to documentation?

This kvec/bvec talk is a digression from your original goal: reduce unnecessary
kmap() usage. If anyone wants to take on the bvec optimization in this code
path, then by all means lets do it in a separate patch.



More information about the Linux-nvme mailing list