Revision | f30c2e5ba81b8d388b7beeae84e6db5ea8220924 (tree) |
---|---|
Time | 2022-01-28 23:38:23 |
Author | Peter Xu <peterx@redh...> |
Commiter | Juan Quintela |
migration: Do chunk page in postcopy_each_ram_send_discard()
Right now we loop ramblocks for twice, the 1st time chunk the dirty bits with
huge page information; the 2nd time we send the discard ranges. That's not
necessary - we can do them in a single loop.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
@@ -2454,6 +2454,8 @@ static int postcopy_send_discard_bm_ram(MigrationState *ms, RAMBlock *block) | ||
2454 | 2454 | return 0; |
2455 | 2455 | } |
2456 | 2456 | |
2457 | +static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block); | |
2458 | + | |
2457 | 2459 | /** |
2458 | 2460 | * postcopy_each_ram_send_discard: discard all RAMBlocks |
2459 | 2461 | * |
@@ -2476,6 +2478,14 @@ static int postcopy_each_ram_send_discard(MigrationState *ms) | ||
2476 | 2478 | postcopy_discard_send_init(ms, block->idstr); |
2477 | 2479 | |
2478 | 2480 | /* |
2481 | + * Deal with TPS != HPS and huge pages. It discard any partially sent | |
2482 | + * host-page size chunks, mark any partially dirty host-page size | |
2483 | + * chunks as all dirty. In this case the host-page is the host-page | |
2484 | + * for the particular RAMBlock, i.e. it might be a huge page. | |
2485 | + */ | |
2486 | + postcopy_chunk_hostpages_pass(ms, block); | |
2487 | + | |
2488 | + /* | |
2479 | 2489 | * Postcopy sends chunks of bitmap over the wire, but it |
2480 | 2490 | * just needs indexes at this point, avoids it having |
2481 | 2491 | * target page specific code. |
@@ -2575,7 +2585,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block) | ||
2575 | 2585 | int ram_postcopy_send_discard_bitmap(MigrationState *ms) |
2576 | 2586 | { |
2577 | 2587 | RAMState *rs = ram_state; |
2578 | - RAMBlock *block; | |
2579 | 2588 | |
2580 | 2589 | RCU_READ_LOCK_GUARD(); |
2581 | 2590 |
@@ -2587,15 +2596,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms) | ||
2587 | 2596 | rs->last_sent_block = NULL; |
2588 | 2597 | rs->last_page = 0; |
2589 | 2598 | |
2590 | - RAMBLOCK_FOREACH_NOT_IGNORED(block) { | |
2591 | - /* | |
2592 | - * Deal with TPS != HPS and huge pages. It discard any partially sent | |
2593 | - * host-page size chunks, mark any partially dirty host-page size | |
2594 | - * chunks as all dirty. In this case the host-page is the host-page | |
2595 | - * for the particular RAMBlock, i.e. it might be a huge page. | |
2596 | - */ | |
2597 | - postcopy_chunk_hostpages_pass(ms, block); | |
2598 | - } | |
2599 | 2599 | trace_ram_postcopy_send_discard_bitmap(); |
2600 | 2600 | |
2601 | 2601 | return postcopy_each_ram_send_discard(ms); |