mbox series

[v4,0/3] MSG_ZEROCOPY for multifd

Message ID 20211009075612.230283-1-leobras@redhat.com (mailing list archive)
Headers show
Series MSG_ZEROCOPY for multifd | expand

Message

Leonardo Bras Oct. 9, 2021, 7:56 a.m. UTC
This patch series intends to enable MSG_ZEROCOPY in QIOChannel, and make
use of it for multifd migration performance improvement.

Patch #1 creates new callbacks for QIOChannel, allowing the implementation
of zerocopy writing.

Patch #2 implements writev_zerocopy and flush_zerocopy on QIOChannelSocket,
making use of MSG_ZEROCOPY on Linux.

Patch #3 Makes use of QIOChannelSocket zerocopy implementation on
nocomp multifd migration.

Results:
So far, the resource usage of __sys_sendmsg() reduced 15 times, and the
overall migration took 13-22% less time, based in synthetic workload.

The objective is to reduce migration time in hosts with heavy cpu usage.

---
Changes since v3:
- QIOChannel interface names changed from io_async_{writev,flush} to
  io_{writev,flush}_zerocopy
- Instead of falling back in case zerocopy is not implemented, return
  error and abort operation.
- Flush now waits as long as needed, or return error in case anything 
  goes wrong, aborting the operation.
- Zerocopy is now conditional in multifd, being set by parameter 
  multifd-zerocopy
- Moves zerocopy_flush to multifd_send_sync_main() from multifd_save_cleanup
  so migration can abort if flush goes wrong.
- Several other small improvements

Changes since v2:
- Patch #1: One more fallback
- Patch #2: Fall back to sync if fails to lock buffer memory in MSG_ZEROCOPY send.

Changes since v1:
- Reimplemented the patchset using async_write + async_flush approach.
- Implemented a flush to be able to tell whenever all data was written.

Leonardo Bras (3):
  QIOChannel: Add io_writev_zerocopy & io_flush_zerocopy callbacks
  QIOChannelSocket: Implement io_writev_zerocopy & io_flush_zerocopy for
    CONFIG_LINUX
  multifd: Implement zerocopy write in multifd migration
    (multifd-zerocopy)

 qapi/migration.json         |  18 ++++
 include/io/channel-socket.h |   2 +
 include/io/channel.h        | 104 +++++++++++++++++----
 migration/migration.h       |   1 +
 migration/multifd.h         |   2 +-
 io/channel-socket.c         | 180 ++++++++++++++++++++++++++++++++++--
 io/channel.c                |  74 +++++++++++----
 migration/migration.c       |  20 ++++
 migration/multifd.c         |  33 ++++++-
 migration/ram.c             |  20 ++--
 monitor/hmp-cmds.c          |   4 +
 11 files changed, 399 insertions(+), 59 deletions(-)