[PATCH 0/8] migration: cleanups, fixes and micro-optimizations

Bin Guo posted 8 patches 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260518110112.21395-1-guobin@linux.alibaba.com
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
migration/fd.c           | 10 +---------
migration/global_state.c |  2 +-
migration/multifd.c      | 32 +++++++++++++++++--------------
migration/savevm.c       |  5 ++---
migration/vmstate.c      | 41 ++++++++++++++++------------------------
5 files changed, 38 insertions(+), 52 deletions(-)
[PATCH 0/8] migration: cleanups, fixes and micro-optimizations
Posted by Bin Guo 1 week, 5 days ago
This series collects several small improvements to the migration
subsystem:

- Bug fix: off-by-one in multifd recv channel ID validation that
  could allow an out-of-bounds write (patch 5).
- Micro-optimizations: cache migrate_multifd_channels() in hot
  paths (patches 7-8), use stack-allocated bitmap instead of
  heap (patch 4), avoid per-element heap churn in vmstate ptr
  marker field (patch 3).
- Cleanups: collapse migration_fd_valid into a single boolean
  expression (patch 1), replace strcpy("") with explicit NUL
  termination (patch 2), merge thread-join and cleanup loops in
  multifd_recv_cleanup (patch 6).

No functional change intended except for the off-by-one fix in
patch 5.

Bin Guo (8):
  migration/fd: collapse migration_fd_valid into single boolean
    expression
  migration/global_state: replace strcpy("") with explicit NUL
    termination
  migration/vmstate: avoid per-element heap churn in vmsd ptr marker
    field
  migration/savevm: use stack-allocated bitmap in
    configuration_validate_capabilities
  migration/multifd: fix off-by-one in recv channel ID validation
  migration/multifd: merge thread-join and cleanup loops in
    multifd_recv_cleanup
  migration/multifd: cache migrate_multifd_channels() in send/recv hot
    paths
  migration/multifd: cache channel count in multifd_send_sync_main

 migration/fd.c           | 10 +---------
 migration/global_state.c |  2 +-
 migration/multifd.c      | 32 +++++++++++++++++--------------
 migration/savevm.c       |  5 ++---
 migration/vmstate.c      | 41 ++++++++++++++++------------------------
 5 files changed, 38 insertions(+), 52 deletions(-)

-- 
2.50.1 (Apple Git-155)
Re: [PATCH 0/8] migration: cleanups, fixes and micro-optimizations
Posted by Peter Xu 1 week, 2 days ago
On Mon, May 18, 2026 at 07:01:04PM +0800, Bin Guo wrote:
> This series collects several small improvements to the migration
> subsystem:
> 
> - Bug fix: off-by-one in multifd recv channel ID validation that
>   could allow an out-of-bounds write (patch 5).
> - Micro-optimizations: cache migrate_multifd_channels() in hot
>   paths (patches 7-8), use stack-allocated bitmap instead of
>   heap (patch 4), avoid per-element heap churn in vmstate ptr
>   marker field (patch 3).
> - Cleanups: collapse migration_fd_valid into a single boolean
>   expression (patch 1), replace strcpy("") with explicit NUL
>   termination (patch 2), merge thread-join and cleanup loops in
>   multifd_recv_cleanup (patch 6).
> 
> No functional change intended except for the off-by-one fix in
> patch 5.
> 
> Bin Guo (8):
>   migration/fd: collapse migration_fd_valid into single boolean
>     expression
>   migration/global_state: replace strcpy("") with explicit NUL
>     termination
>   migration/vmstate: avoid per-element heap churn in vmsd ptr marker
>     field
>   migration/savevm: use stack-allocated bitmap in
>     configuration_validate_capabilities
>   migration/multifd: fix off-by-one in recv channel ID validation
>   migration/multifd: merge thread-join and cleanup loops in
>     multifd_recv_cleanup
>   migration/multifd: cache migrate_multifd_channels() in send/recv hot
>     paths
>   migration/multifd: cache channel count in multifd_send_sync_main

For patch 1, I tend to agree with Fabiano; I don't clearly see why the
oneliner is always better.  Oneliners can be harder to read to some (for
most of the cases, myself included..).

For patch 6, I confess I can't see an issue with the current patch, but
since there's a discussion, let it happen.

I queued the rest, thanks.

-- 
Peter Xu