Hello Peter, On Wed, Jun 1, 2022 at 10:58 AM Peter Xu <pet...@redhat.com> wrote: > [...] > > Hi, Leonardo. I'm also paying attention to the application of MSG_ZEROCOPY > > in live migration recently. I noticed that you defined a member > > `zero_copy_queued` in the struct QIOChannelSocket, but I can't find out > > where the value of this member has been changed in your patch. Can you > > answer it for me? > > > > Good point.. it should probably be increased when queuing the pages. We'd > better fix it up or it seems the flush() will be literally an no-op..
That's correct. I am working on a fix right now. The idea is to increment it in qio_channel_socket_writev() if sendmsg succeeds. > > Two things in qio_channel_socket_flush() we can do to make sure it'll work > as expected, imo: > > 1) make ret=-1 as initial value, rather than 1 - we only check negative > errors in the caller so we could have missed a positive "1" > > 2) add a tracepoint into the loop of updating zero_copy_sent > > Leo, what's your take? (1) is not an option, as the interface currently uses ret=1 to make sure MSG_ZEROCOPY is getting used, I added that so the user of qio_channel can switch off zero-copy if it's not getting used, and save some cpu. (2) is not a problem, but I fail to see how useful that would be. Is the idea manually keeping track of flush happening? Best regards, Leo