* [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass @ 2019-07-10 5:08 Wei Yang 2019-07-10 5:08 ` [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr Wei Yang ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Wei Yang @ 2019-07-10 5:08 UTC (permalink / raw) To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela Here are two trivial function cleanup. BTW, I didn't test them since TPS == HPS. How could I setup a guest with TPS != HPS? Wei Yang (2): migration/postcopy: reduce one operation to calculate fixup_start_addr migration/postcopy: do_fixup is true when host_offset is non-zero migration/ram.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr 2019-07-10 5:08 [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Wei Yang @ 2019-07-10 5:08 ` Wei Yang 2019-07-19 15:48 ` Dr. David Alan Gilbert 2019-07-10 5:08 ` [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero Wei Yang 2019-08-07 17:25 ` [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Dr. David Alan Gilbert 2 siblings, 1 reply; 6+ messages in thread From: Wei Yang @ 2019-07-10 5:08 UTC (permalink / raw) To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela Use the same way for run_end to calculate run_start, which saves one operation. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> --- migration/ram.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 410e0f89fe..c4dc36e525 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2884,10 +2884,12 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, host_offset = run_start % host_ratio; if (host_offset) { do_fixup = true; - run_start -= host_offset; - fixup_start_addr = run_start; - /* For the next pass */ - run_start = run_start + host_ratio; + fixup_start_addr = run_start - host_offset; + /* + * This host page has gone, the next loop iteration starts + * from after the fixup + */ + run_start = fixup_start_addr + host_ratio; } else { /* Find the end of this run */ unsigned long run_end; -- 2.17.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr 2019-07-10 5:08 ` [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr Wei Yang @ 2019-07-19 15:48 ` Dr. David Alan Gilbert 0 siblings, 0 replies; 6+ messages in thread From: Dr. David Alan Gilbert @ 2019-07-19 15:48 UTC (permalink / raw) To: Wei Yang; +Cc: qemu-devel, quintela * Wei Yang (richardw.yang@linux.intel.com) wrote: > Use the same way for run_end to calculate run_start, which saves one > operation. > > Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > migration/ram.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/migration/ram.c b/migration/ram.c > index 410e0f89fe..c4dc36e525 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -2884,10 +2884,12 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, > host_offset = run_start % host_ratio; > if (host_offset) { > do_fixup = true; > - run_start -= host_offset; > - fixup_start_addr = run_start; > - /* For the next pass */ > - run_start = run_start + host_ratio; > + fixup_start_addr = run_start - host_offset; > + /* > + * This host page has gone, the next loop iteration starts > + * from after the fixup > + */ > + run_start = fixup_start_addr + host_ratio; > } else { > /* Find the end of this run */ > unsigned long run_end; > -- > 2.17.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero 2019-07-10 5:08 [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Wei Yang 2019-07-10 5:08 ` [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr Wei Yang @ 2019-07-10 5:08 ` Wei Yang 2019-07-19 15:56 ` Dr. David Alan Gilbert 2019-08-07 17:25 ` [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Dr. David Alan Gilbert 2 siblings, 1 reply; 6+ messages in thread From: Wei Yang @ 2019-07-10 5:08 UTC (permalink / raw) To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela This means it is not necessary to spare an extra variable to hold this condition. Use host_offset directly is fine. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> --- migration/ram.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c4dc36e525..b0ca0059c4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2873,7 +2873,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, } while (run_start < pages) { - bool do_fixup = false; unsigned long fixup_start_addr; unsigned long host_offset; @@ -2883,7 +2882,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, */ host_offset = run_start % host_ratio; if (host_offset) { - do_fixup = true; fixup_start_addr = run_start - host_offset; /* * This host page has gone, the next loop iteration starts @@ -2905,7 +2903,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, */ host_offset = run_end % host_ratio; if (host_offset) { - do_fixup = true; fixup_start_addr = run_end - host_offset; /* * This host page has gone, the next loop iteration starts @@ -2921,7 +2918,7 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, } } - if (do_fixup) { + if (host_offset) { unsigned long page; /* Tell the destination to discard this page */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero 2019-07-10 5:08 ` [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero Wei Yang @ 2019-07-19 15:56 ` Dr. David Alan Gilbert 0 siblings, 0 replies; 6+ messages in thread From: Dr. David Alan Gilbert @ 2019-07-19 15:56 UTC (permalink / raw) To: Wei Yang; +Cc: qemu-devel, quintela * Wei Yang (richardw.yang@linux.intel.com) wrote: > This means it is not necessary to spare an extra variable to hold this > condition. Use host_offset directly is fine. > > Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > migration/ram.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/migration/ram.c b/migration/ram.c > index c4dc36e525..b0ca0059c4 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -2873,7 +2873,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, > } > > while (run_start < pages) { > - bool do_fixup = false; > unsigned long fixup_start_addr; > unsigned long host_offset; > > @@ -2883,7 +2882,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, > */ > host_offset = run_start % host_ratio; > if (host_offset) { > - do_fixup = true; > fixup_start_addr = run_start - host_offset; > /* > * This host page has gone, the next loop iteration starts > @@ -2905,7 +2903,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, > */ > host_offset = run_end % host_ratio; > if (host_offset) { > - do_fixup = true; > fixup_start_addr = run_end - host_offset; > /* > * This host page has gone, the next loop iteration starts > @@ -2921,7 +2918,7 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass, > } > } > > - if (do_fixup) { > + if (host_offset) { > unsigned long page; > > /* Tell the destination to discard this page */ > -- > 2.17.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass 2019-07-10 5:08 [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Wei Yang 2019-07-10 5:08 ` [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr Wei Yang 2019-07-10 5:08 ` [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero Wei Yang @ 2019-08-07 17:25 ` Dr. David Alan Gilbert 2 siblings, 0 replies; 6+ messages in thread From: Dr. David Alan Gilbert @ 2019-08-07 17:25 UTC (permalink / raw) To: Wei Yang; +Cc: qemu-devel, quintela * Wei Yang (richardw.yang@linux.intel.com) wrote: > Here are two trivial function cleanup. Queued > BTW, I didn't test them since TPS == HPS. How could I setup a guest with > TPS != HPS? > > Wei Yang (2): > migration/postcopy: reduce one operation to calculate fixup_start_addr > migration/postcopy: do_fixup is true when host_offset is non-zero > > migration/ram.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > -- > 2.17.1 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-08-07 17:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-07-10 5:08 [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Wei Yang 2019-07-10 5:08 ` [Qemu-devel] [PATCH 1/2] migration/postcopy: reduce one operation to calculate fixup_start_addr Wei Yang 2019-07-19 15:48 ` Dr. David Alan Gilbert 2019-07-10 5:08 ` [Qemu-devel] [PATCH 2/2] migration/postcopy: do_fixup is true when host_offset is non-zero Wei Yang 2019-07-19 15:56 ` Dr. David Alan Gilbert 2019-08-07 17:25 ` [Qemu-devel] [PATCH 0/2] migration/postcopy: cleanup function postcopy_chunk_hostpages_pass Dr. David Alan Gilbert
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).