Re: [PATCH net-next v3 01/18] net: Copy slab data for sendmsg(MSG_SPLICE_PAGES)

From: Paolo Abeni
Date: Fri Jun 23 2023 - 05:53:32 EST


On Fri, 2023-06-23 at 10:08 +0100, David Howells wrote:
> Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> > If we can't reach instant agreement --
> > can you strategically separate out the minimal set of changes required
> > to just kill MSG_SENDPAGE_NOTLAST. IMHO it's worth getting that into
> > 6.5.
>
> Paolo Abeni <pabeni@xxxxxxxxxx> wrote:
>
> > Given all the above, and the late stage of the current devel cycle,
> > would you consider slicing down this series to just kill
> > MSG_SENDPAGE_NOTLAST, as Jakub suggested?
>
> I could do that.
>
> There is also another alternative. I could just push the sendpage wrappers up
> the stack into the higher-level callers. Basically this:
>
> int udp_sendpage(struct sock *sk, struct page *page, int offset,
> size_t size, int flags)
> {
> struct bio_vec bvec;
> struct msghdr msg = { .msg_flags = flags | MSG_SPLICE_PAGES };
>
> if (flags & MSG_SENDPAGE_NOTLAST)
> msg.msg_flags |= MSG_MORE;
>
> bvec_set_page(&bvec, page, size, offset);
> iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, size);
> return udp_sendmsg(sk, &msg, size);
> }
>
> and kill off sendpage and MSG_SENDPAGE_NOTLAST.

I'm unsure I follow the above ?!? I *thought* sendpage could be killed
even without patch 1/18 and 2/18, leaving some patches in this series
unmodified, and mangling those explicitly leveraging 1/18 to use
multiple sendmsg()s with different flags?

I haven't tried to code the above, but my wild guess/hope is that the
delta should be doable - ideally less then the other option.

Introducing slab support should still be possible later, with hopefully
less work.

Cheers,

Paolo