migration/block: Avoid invoking blk_drain too frequently
PATCH v2 1/1 migration/block: Avoid invoking blk_drain too frequently
Increase bmds->cur_dirty after submit io, so reduce the frequency involve into blk_drain, and improve the performance obviously when block migration.
The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)
migration/block.c +3 -0
@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;
Signature · 1 line
1.8.3.1
Am 15.03.2017 um 04:37 hat Lidong Chen geschrieben:
Quoted 20 lines
Increase
bmds->cur_dirtyafter submit io, so reduce the frequency involve intoblk_drain, and improve the performance obviously when block migration.The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
Signed-off-by Lidong Chen <[email protected]>--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)migration/block.c +0
-0
migration/block.c static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, · line 579
Quoted 4 lines
migration/block.c +1
-0@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors;
sector += BDRV_SECTORS_PER_DIRTY_CHUNK would be acceptable here...
Quoted 7 lines
migration/block.c +2
-0+ bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;bmds->cur_dirty = sector; }
...which would make it the same code as the rest of the loop. It could be nicer to reuse the same code and just set a bool when a request is submitted so that the loop terminates after that.
But that's just a matter of taste, so I'll still give:
Quoted 32 lines · Lidong Chen
Increase
bmds->cur_dirtyafter submit io, so reduce the frequency involve intoblk_drain, and improve the performance obviously when block migration.The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
Signed-off-by Lidong Chen <[email protected]>--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)migration/block.c +3
-0@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;Signature · 1 line
1.8.3.1
Nice catch above all, thank you!
Quoted 36 lines · * Fam Zheng ([email protected]) wrote:
Quoted 32 lines · Lidong Chen
Increase
bmds->cur_dirtyafter submit io, so reduce the frequency involve intoblk_drain, and improve the performance obviously when block migration.The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
Signed-off-by Lidong Chen <[email protected]>--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)migration/block.c +3
-0@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;Signature · 1 line
1.8.3.1Nice catch above all, thank you!
Quoted 1 line
Reviewed-by Fam Zheng <[email protected]>
Are you taking that via a block pull?
Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 37 lines · Dr. David Alan Gilbert
Quoted 36 lines · * Fam Zheng ([email protected]) wrote:
Quoted 32 lines · Lidong Chen
Increase
bmds->cur_dirtyafter submit io, so reduce the frequency involve intoblk_drain, and improve the performance obviously when block migration.The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
Signed-off-by Lidong Chen <[email protected]>--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)migration/block.c +3
-0@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;Signature · 1 line
1.8.3.1Nice catch above all, thank you!
Quoted 3 lines
Quoted 1 line
Reviewed-by Fam Zheng <[email protected]>Are you taking that via a block pull?
I can do that, but I'm not sure whether it should go to 2.9. This is a performance improvement, which usually doesn't qualify as bug fixes. But this also looks like a mistake in original code.
Fam
Quoted 40 lines · Fam Zheng
Quoted 39 lines · Dr. David Alan Gilbert
Quoted 37 lines · * Fam Zheng ([email protected]) wrote:
Quoted 32 lines · Lidong Chen
Increase
bmds->cur_dirtyafter submit io, so reduce the frequency involve intoblk_drain, and improve the performance obviously when block migration.The performance test result of this patch:
During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s.
Signed-off-by Lidong Chen <[email protected]>--- migration/block.c | 3 +++ 1 file changed, 3 insertions(+)migration/block.c +3
-0@@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, }bdrv_reset_dirty_bitmap (bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; +break ; } sector +=BDRV_SECTORS_PER_DIRTY_CHUNK ;Signature · 1 line
1.8.3.1Nice catch above all, thank you!
Reviewed-by Fam Zheng <[email protected]>
Quoted 7 lines
Quoted 1 line
Are you taking that via a block pull?
I can do that, but I'm not sure whether it should go to 2.9. This is a performance improvement, which usually doesn't qualify as bug fixes. But this also looks like a mistake in original code.
Fam
I am taking it through migration and push it. I agree with your description.