All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Vasily Tarasov <tarasov@vasily.name>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	Michael Mattsson <michael.mattsson@gmail.com>
Subject: Re: Fix for a race when fio prints I/O statistics periodically
Date: Mon, 10 Nov 2014 08:33:23 -0700	[thread overview]
Message-ID: <5460DAC3.8000000@kernel.dk> (raw)
In-Reply-To: <CAFTzLMNOYv+8uP2wiQOPcLjhZG9zoQiOCNn8_69dYV45Ex8aTQ@mail.gmail.com>

On 2014-11-10 07:19, Vasily Tarasov wrote:
> Hi Jens,
>
> td->start is used in  __show_running_run_stats() to compute the time
> that passed since the beginning of the loop (stored in td->start) to
> the moment when periodical statistics need to be printed. Then
> td->ts.runtime[] is temporarily updated based on the computed value.
>
> In thread_main(), similar actions are taken to update td->ts.runtime[]
> based on the td->start and the loop's elapsed time. Without the patch,
> td->start is set in the very beginning of the loop in thread_main().
> So, it leaves a time window between the end of the current loop and
> the beginning of the next loop when td->ts.runtime[] is already
> updated while td->start still stores the start of the previous lop. If
> __show_running_run_stats() is called during that window - the time can
> be (temporarily) added twice to td->ts.runtime[].
>
> However, if we reset the start time in the end of the loop under the
> stat_mutex it should not happen.
>
> I would agree that having a per-td mutex might be an overkill
> considering that people usually print statistics periodically with
> relatively long intervals: 1, 5, 10, 60 seconds.

Thanks, I missed the change in addition after IO was done, hence the 
question on ->start. I did commit the patch as-is yesterday, thanks!

-- 
Jens Axboe



  reply	other threads:[~2014-11-10 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 17:10 Fix for a race when fio prints I/O statistics periodically Vasily Tarasov
2014-11-05 17:19 ` Michael Mattsson
2014-11-08 16:28 ` Jens Axboe
2014-11-08 16:33   ` Michael Mattsson
2014-11-10 14:19   ` Vasily Tarasov
2014-11-10 15:33     ` Jens Axboe [this message]
2014-12-02 23:00       ` Michael Mattsson
2014-12-02 23:36         ` Jens Axboe

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=5460DAC3.8000000@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=michael.mattsson@gmail.com \
    --cc=tarasov@vasily.name \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.