mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Postcopy: Mark nohugepage before discard
Prior to servicing userfault requests we must ensure we've not got huge pages in the area that might include non-transferred memory, since a hugepage could incorrectly mark the whole huge page as present. We mark the area as non-huge page (nhp) just before we perform discards; the discard code now tells us to discard any areas that haven't been sent (as well as any that are redirtied); any already formed transparent-huge-pages get fragmented by this discard process if they cotnain any discards. Transparent huge pages that have been entirely transferred and don't contain any discards are not broken by this mechanism; they stay as huge pages. By starting postcopy after a full precopy pass, many of the pages then stay as huge pages; this is important for maintaining performance after the end of the migration. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
27c6825bd3
commit
f952710757
4 changed files with 59 additions and 4 deletions
|
@ -1316,7 +1316,7 @@ static int loadvm_postcopy_ram_handle_discard(MigrationIncomingState *mis,
|
|||
switch (ps) {
|
||||
case POSTCOPY_INCOMING_ADVISE:
|
||||
/* 1st discard */
|
||||
tmp = 0; /* TODO: later patch postcopy_ram_prepare_discard(mis); */
|
||||
tmp = postcopy_ram_prepare_discard(mis);
|
||||
if (tmp) {
|
||||
return tmp;
|
||||
}
|
||||
|
@ -1448,6 +1448,13 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis)
|
|||
error_report("CMD_POSTCOPY_LISTEN in wrong postcopy state (%d)", ps);
|
||||
return -1;
|
||||
}
|
||||
if (ps == POSTCOPY_INCOMING_ADVISE) {
|
||||
/*
|
||||
* A rare case, we entered listen without having to do any discards,
|
||||
* so do the setup that's normally done at the time of the 1st discard.
|
||||
*/
|
||||
postcopy_ram_prepare_discard(mis);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sensitise RAM - can now generate requests for blocks that don't exist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue