Message ID | 20221025135958.6242-3-aaptel@nvidia.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | nvme-tcp receive offloads | expand |
I don't think this is a good subject line. What the patch does is to skip the memcpy, so something about that in the subject. You can then explain the commit log why that is done. And given that the behavior isn't all that obvious I think a big fat comment in the code would be very helpful in this case as well.
On Tue, 25 Oct 2022 16:59:37 +0300 Aurelien Aptel wrote: > Signed-off-by: Ben Ben-Ishay <benishay@nvidia.com> > Signed-off-by: Boris Pismenny <borisp@nvidia.com> > Signed-off-by: Or Gerlitz <ogerlitz@nvidia.com> > Signed-off-by: Yoray Zack <yorayz@nvidia.com> > Signed-off-by: Shai Malin <smalin@nvidia.com> > Signed-off-by: Aurelien Aptel <aaptel@nvidia.com> Great stuff :) Please get someone who matters to ack this. > Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> > --- > lib/iov_iter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/iov_iter.c b/lib/iov_iter.c > index c3ca28ca68a6..75470a4b8ab3 100644 > --- a/lib/iov_iter.c > +++ b/lib/iov_iter.c > @@ -526,7 +526,7 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) > might_fault(); > iterate_and_advance(i, bytes, base, len, off, > copyout(base, addr + off, len), > - memcpy(base, addr + off, len) > + (base != addr + off) && memcpy(base, addr + off, len)
Hi Christoph, Christoph Hellwig <hch@lst.de> writes: > I don't think this is a good subject line. What the patch does is > to skip the memcpy, so something about that in the subject. You Sure, we will use the following subject: iov_iter: skip copy if src == dst for direct data placement > can then explain the commit log why that is done. And given that > the behavior isn't all that obvious I think a big fat comment in the > code would be very helpful in this case as well. And we will add the big comment.
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index c3ca28ca68a6..75470a4b8ab3 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -526,7 +526,7 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) might_fault(); iterate_and_advance(i, bytes, base, len, off, copyout(base, addr + off, len), - memcpy(base, addr + off, len) + (base != addr + off) && memcpy(base, addr + off, len) ) return bytes;