]> git.proxmox.com Git - mirror_qemu.git/commit
migration/postcopy: simplify calculation of run_start and fixup_start_addr
authorWei Yang <richardw.yang@linux.intel.com>
Tue, 6 Aug 2019 00:46:47 +0000 (08:46 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 14 Aug 2019 16:33:14 +0000 (17:33 +0100)
commitdad45ab2be9d5ce033ddba328204b06f2d10f0ed
tree947efdd42eac7046c0475728365e9c82e75a0c19
parent810cf2bbd4c5c1417bda8bec49caf0ababc22860
migration/postcopy: simplify calculation of run_start and fixup_start_addr

The purpose of the calculation is to find a HostPage which is partially
dirty.

  * fixup_start_addr points to the start of the HostPage to discard
  * run_start points to the next HostPage to check

While in the middle stage, there would two cases for run_start:

  * aligned with HostPage means this is not partially dirty
  * not aligned means this is partially dirty

When it is aligned, no work and calculation is necessary. run_start
already points to the start of next HostPage and is ready to continue.

When it is not aligned, the calculation could be simplified with:

  * fixup_start_addr = QEMU_ALIGN_DOWN(run_start, host_ratio)
  * run_start = QEMU_ALIGN_UP(run_start, host_ratio)

By doing so, run_start always points to the next HostPage to check.
fixup_start_addr always points to the HostPage to discard.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190806004648.8659-2-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/ram.c