[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210201173548.GA12960@lst.de>
Date: Mon, 1 Feb 2021 18:35:48 +0100
From: Christoph Hellwig <hch@....de>
To: Boris Pismenny <borisp@...lanox.com>
Cc: dsahern@...il.com, kuba@...nel.org, davem@...emloft.net,
saeedm@...dia.com, hch@....de, sagi@...mberg.me, axboe@...com,
kbusch@...nel.org, viro@...iv.linux.org.uk, edumazet@...gle.com,
smalin@...vell.com, boris.pismenny@...il.com,
linux-nvme@...ts.infradead.org, netdev@...r.kernel.org,
benishay@...dia.com, ogerlitz@...dia.com, yorayz@...dia.com,
Ben Ben-Ishay <benishay@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Yoray Zack <yorayz@...lanox.com>
Subject: Re: [PATCH v3 net-next 01/21] iov_iter: Introduce new procedures
for copy to iter/pages
On Mon, Feb 01, 2021 at 12:04:49PM +0200, Boris Pismenny wrote:
> +static __always_inline __must_check
> +size_t ddp_copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i)
> +{
> + if (unlikely(!check_copy_size(addr, bytes, true)))
> + return 0;
> + else
> + return _ddp_copy_to_iter(addr, bytes, i);
> +}
No need for the else after a return, and the normal kernel convention
double underscores for magic internal functions.
But more importantly: does this belong into the generic header without
and comments what the ddp means and when it should be used?
> +static void ddp_memcpy_to_page(struct page *page, size_t offset, const char *from, size_t len)
Overly long line. But we're also looking into generic helpers for
this kind of things, not sure if they made it to linux-next in the
meantime, but please check.
> +size_t _ddp_copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i)
> +{
> + const char *from = addr;
> + if (unlikely(iov_iter_is_pipe(i)))
> + return copy_pipe_to_iter(addr, bytes, i);
> + if (iter_is_iovec(i))
> + might_fault();
> + iterate_and_advance(i, bytes, v,
> + copyout(v.iov_base, (from += v.iov_len) - v.iov_len, v.iov_len),
> + ddp_memcpy_to_page(v.bv_page, v.bv_offset,
> + (from += v.bv_len) - v.bv_len, v.bv_len),
> + memcpy(v.iov_base, (from += v.iov_len) - v.iov_len, v.iov_len)
> + )
> +
> + return bytes;
> +}
This bloats every kernel build, so please move it into a conditionally
built file. And please document the whole thing.
Powered by blists - more mailing lists