Fabiano Rosas <faro...@suse.de> writes: > From: Nikolay Borisov <nbori...@suse.com> > > Implement 'fixed-ram' feature. The core of the feature is to ensure that > each ram page of the migration stream has a specific offset in the > resulting migration stream. The reason why we'd want such behavior are > two fold: > > - When doing a 'fixed-ram' migration the resulting file will have a > bounded size, since pages which are dirtied multiple times will > always go to a fixed location in the file, rather than constantly > being added to a sequential stream. This eliminates cases where a vm > with, say, 1G of ram can result in a migration file that's 10s of > GBs, provided that the workload constantly redirties memory. > > - It paves the way to implement DIO-enabled save/restore of the > migration stream as the pages are ensured to be written at aligned > offsets. > > The feature requires changing the stream format. First, a bitmap is > introduced which tracks which pages have been written (i.e are > dirtied) during migration and subsequently it's being written in the > resulting file, again at a fixed location for every ramblock. Zero > pages are ignored as they'd be zero in the destination migration as > well. With the changed format data would look like the following: > > |name len|name|used_len|pc*|bitmap_size|pages_offset|bitmap|pages| > > * pc - refers to the page_size/mr->addr members, so newly added members > begin from "bitmap_size". > > This layout is initialized during ram_save_setup so instead of having a > sequential stream of pages that follow the ramblock headers the dirty > pages for a ramblock follow its header. Since all pages have a fixed > location RAM_SAVE_FLAG_EOS is no longer generated on every migration > iteration but there is effectively a single RAM_SAVE_FLAG_EOS right at > the end. > > Signed-off-by: Nikolay Borisov <nbori...@suse.com> > Signed-off-by: Fabiano Rosas <faro...@suse.de>
[...] > diff --git a/qapi/migration.json b/qapi/migration.json > index c84fa10e86..22eea58ce3 100644 > --- a/qapi/migration.json > +++ b/qapi/migration.json > @@ -485,7 +485,7 @@ > ## > { 'enum': 'MigrationCapability', > 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', > - 'compress', 'events', 'postcopy-ram', > + 'compress', 'events', 'postcopy-ram', 'fixed-ram', > { 'name': 'x-colo', 'features': [ 'unstable' ] }, > 'release-ram', > 'block', 'return-path', 'pause-before-switchover', 'multifd', Doc comment update is missing.