From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 11/13] block/mirror: remove block_job_sleep_ns calls
Date: Wed, 7 Feb 2018 23:46:25 +0100 [thread overview]
Message-ID: <98b08bf5-6ac1-a1df-e92d-046b7975e3de@redhat.com> (raw)
In-Reply-To: <20180119205847.7141-12-jsnow@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3164 bytes --]
On 2018-01-19 21:58, John Snow wrote:
> We're attempting to slacken the mirror loop in three different places,
> but we can combine these three attempts. Combine the early loop call to
> block_job_pause_point with the two late-loop calls to block_job_sleep_ns.
>
> When delay_ns is 0 and it has not been SLICE_TIME since the last yield,
> block_job_relax is merely a call to block_job_pause_point, so this should
> be equivalent with the exception that if we have managed to not yield at
> all in the last SLICE_TIME ns, we will now do so.
>
> I am not sure that condition was possible,
> so this loop should be equivalent.
Well, to me it even sounds like a positive change if it was a change.
We want the job to yield after SLICE_TIME ns, after all, and I don't
think it matters where that happens, exactly.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> block/mirror.c | 22 +++++++++++-----------
> block/trace-events | 2 +-
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index a0e0044de2..192e03694f 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -761,7 +761,7 @@ static void coroutine_fn mirror_run(void *opaque)
> assert(!s->dbi);
> s->dbi = bdrv_dirty_iter_new(s->dirty_bitmap);
> for (;;) {
> - uint64_t delay_ns = 0;
> + static uint64_t delay_ns = 0;
Errr. Are you sure about that?
Now every mirror job in the qeny process will share this single
variable. Was that your intention?
> int64_t cnt, delta;
> bool should_complete;
>
> @@ -770,9 +770,16 @@ static void coroutine_fn mirror_run(void *opaque)
> goto immediate_exit;
> }
>
> - block_job_pause_point(&s->common);
> -
> cnt = bdrv_get_dirty_count(s->dirty_bitmap);
> +
> + trace_mirror_before_relax(s, cnt, s->synced, delay_ns);
> + if (block_job_relax(&s->common, delay_ns)) {
See the reply to <a href="HEAD^^">that patch</a>.
> + if (!s->synced) {
> + goto immediate_exit;
> + }
> + }
> + delay_ns = 0;
> +
> /* s->common.offset contains the number of bytes already processed so
> * far, cnt is the number of dirty bytes remaining and
> * s->bytes_in_flight is the number of bytes currently being
> @@ -849,15 +856,8 @@ static void coroutine_fn mirror_run(void *opaque)
> }
>
> ret = 0;
> - trace_mirror_before_sleep(s, cnt, s->synced, delay_ns);
> - if (!s->synced) {
> - block_job_sleep_ns(&s->common, delay_ns);
> - if (block_job_is_cancelled(&s->common)) {
> - break;
> - }
> - } else if (!should_complete) {
> + if (s->synced && !should_complete) {
> delay_ns = (s->in_flight == 0 && cnt == 0 ? SLICE_TIME : 0);
> - block_job_sleep_ns(&s->common, delay_ns);
> }
> }
Basic idea looks good to me (apart from the static delay_ns), but, well,
block-job-cancel on a busy job still breaks.
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2018-02-07 22:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 20:58 [Qemu-devel] [PATCH v2 00/13] blockjob: refactor mirror_throttle John Snow
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 01/13] blockjob: record time of last entrance John Snow
2018-02-07 22:05 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 02/13] blockjob: consolidate SLICE_TIME definition John Snow
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 03/13] blockjob: create block_job_relax John Snow
2018-02-07 22:12 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 04/13] blockjob: allow block_job_throttle to take delay_ns John Snow
2018-02-07 22:17 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 05/13] block/commit: use block_job_relax John Snow
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 06/13] block/stream: " John Snow
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 07/13] block/backup: " John Snow
2018-02-07 22:19 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 08/13] allow block_job_relax to return -ECANCELED John Snow
2018-02-07 22:27 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 09/13] block/backup: remove yield_and_check John Snow
2018-02-07 22:33 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 10/13] block/mirror: condense cancellation and relax calls John Snow
2018-02-07 22:36 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 11/13] block/mirror: remove block_job_sleep_ns calls John Snow
2018-02-07 22:46 ` Max Reitz [this message]
2018-02-07 22:56 ` Max Reitz
2018-02-09 23:13 ` John Snow
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 12/13] blockjob: privatize block_job_sleep_ns John Snow
2018-02-07 22:47 ` Max Reitz
2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 13/13] blockjob: remove block_job_pause_point from interface John Snow
2018-02-07 22:50 ` Max Reitz
2018-01-19 21:14 ` [Qemu-devel] [PATCH v2 00/13] blockjob: refactor mirror_throttle no-reply
2018-01-30 20:25 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98b08bf5-6ac1-a1df-e92d-046b7975e3de@redhat.com \
--to=mreitz@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).