qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/13] blockjob: refactor mirror_throttle
@ 2018-01-19 20:58 John Snow
  2018-01-19 20:58 ` [Qemu-devel] [PATCH v2 01/13] blockjob: record time of last entrance John Snow
                   ` (14 more replies)
  0 siblings, 15 replies; 28+ messages in thread
From: John Snow @ 2018-01-19 20:58 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, jcody, qemu-devel, stefanha, mreitz, John Snow

mirror_throttle attempts to make sure we yield every so often when we're
doing operations that may not otherwise be as cooperative as we'd like.

This pattern is useful to other jobs like commit as well; if commit
continuously decides not to copy data (and calculates delay_ns to be 0),
we'll frequently and aggressively yield, only to be rescheduled immediately.

This causes those "WARNING: I/O thread spun for 1000 iterations"
warnings that everyone loves so much.

Split out the mirror_throttle function to become a new internal
BlockJob API function, block_job_throttle; then use it for all
the other jobs in their runtime loops.

I decided to use it in stream and backup as well, so that regardless of if the
loop structure has the chance to be greedy or not (I did not audit this), the
BlockJob has some kind of failsafe that will occasionally perform a 0ns sleep
every SLICE_TIME.

v2:
 - Fixed spacing consistency (Paolo)
 - Renamed last_yield_ns to last_enter_ns (Stefan)
 - Renamed block_job_throttle to block_job_relax (Stefan)
 - Removed external usages of block_job_pause_point and
   block_job_sleep_ns (Paolo)
 - Further cut down block/backup code to use block_job_relax

________________________________________________________________________________

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch block-job-yield
https://github.com/jnsnow/qemu/tree/block-job-yield

This version is tagged block-job-yield-v2:
https://github.com/jnsnow/qemu/releases/tag/block-job-yield-v2

John Snow (13):
  blockjob: record time of last entrance
  blockjob: consolidate SLICE_TIME definition
  blockjob: create block_job_relax
  blockjob: allow block_job_throttle to take delay_ns
  block/commit: use block_job_relax
  block/stream: use block_job_relax
  block/backup: use block_job_relax
  allow block_job_relax to return -ECANCELED
  block/backup: remove yield_and_check
  block/mirror: condense cancellation and relax calls
  block/mirror: remove block_job_sleep_ns calls
  blockjob: privatize block_job_sleep_ns
  blockjob: remove block_job_pause_point from interface

 block/backup.c               | 27 ++++++-----------------
 block/commit.c               |  4 +---
 block/mirror.c               | 52 +++++++++++++++-----------------------------
 block/stream.c               |  4 +---
 block/trace-events           |  2 +-
 blockjob.c                   | 51 ++++++++++++++++++++++++++++++++++++-------
 include/block/blockjob.h     |  5 +++++
 include/block/blockjob_int.h | 37 +++++++++++++++----------------
 tests/test-bdrv-drain.c      |  2 +-
 tests/test-blockjob-txn.c    |  2 +-
 10 files changed, 94 insertions(+), 92 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2018-02-09 23:14 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).