Re: [PATCH net-next v5 04/16] ceph: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage()

From: Ilya Dryomov
Date: Mon Jun 26 2023 - 12:07:39 EST


On Mon, Jun 26, 2023 at 5:30 PM David Howells <dhowells@xxxxxxxxxx> wrote:
>
> Ilya Dryomov <idryomov@xxxxxxxxx> wrote:
>
> > write_partial_message_data() is net/ceph/messenger_v1.c specific, so it
> > doesn't apply here. I would suggest squashing the two net/ceph patches
> > into one since even the titles are the same.
>
> I would, but they're now applied to net-next, so we need to patch that.

I don't see a problem with that given that the patches themselves have
major issues (i.e. it's not just a commit message/title nit).

>
> > > * Write as much as possible. The socket is expected to be corked,
> > > - * so we don't bother with MSG_MORE/MSG_SENDPAGE_NOTLAST here.
> > > + * so we don't bother with MSG_MORE here.
> > > *
> > > * Return:
> > > - * 1 - done, nothing (else) to write
> > > + * >0 - done, nothing (else) to write
> >
> > It would be nice to avoid making tweaks like this to the outer
> > interface as part of switching to a new internal API.
>
> Ok. I'll change that and wrap the sendmsg in a loop. Though, as I asked in
> an earlier reply, why is MSG_DONTWAIT used here?

See my reply there.

>
> > > + if (WARN_ON(!iov_iter_is_bvec(&con->v2.out_iter)))
> > > + return -EINVAL;
> >
> > Previously, this WARN_ON + error applied only to the "try sendpage"
> > path. There is a ton of kvec usage in net/ceph/messenger_v2.c, so I'm
> > pretty sure that placing it here breaks everything.
>
> This should have been removed as MSG_SPLICE_PAGES now accepts KVEC and XARRAY
> iterators also.
>
> Btw, is it feasible to use con->v2.out_iter_sendpage to apply MSG_SPLICE_PAGES
> to the iterator to be transmitted as a whole? It seems to be set depending on
> iterator type.

I'm not sure I understand what you mean by "transmitted as a whole".
con->v2.out_iter_sendpage is set only when zerocopy is desired. If the
underlying data is not guaranteed to remain stable, zerocopy behavior
is not safe.

Thanks,

Ilya