Skip to content

blockjob: refactor mirror_throttle

John Snow qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 13 repliesIn review
  2. v17 patches 21 repliesSuperseded

Changes in v2 from the cover letter

- 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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13blockjob: record time of last entranceblock/mirror.c blockjob.c include/block/blockjob.h+9 -61 reply
2/13blockjob: consolidate SLICE_TIME definitionblock/backup.c block/commit.c block/mirror.c +2 more+2 -60 replies
3/13blockjob: create block_job_relaxblock/mirror.c blockjob.c include/block/blockjob_int.h+22 -131 reply
4/13blockjob: allow block_job_throttle to take delay_nsblock/mirror.c blockjob.c include/block/blockjob_int.h+13 -101 reply
5/13block/commit: use block_job_relaxblock/commit.c+1 -10 replies
6/13block/stream: use block_job_relaxblock/stream.c+1 -10 replies
7/13block/backup: use block_job_relaxblock/backup.c+5 -51 reply
8/13allow block_job_relax to return -ECANCELEDblockjob.c include/block/blockjob_int.h+22 -141 reply
9/13block/backup: remove yield_and_checkblock/backup.c+4 -161 reply
10/13block/mirror: condense cancellation and relax callsblock/mirror.c+2 -61 reply
11/13block/mirror: remove block_job_sleep_ns callsblock/mirror.c block/trace-events+12 -123 replies
12/13blockjob: privatize block_job_sleep_nsblockjob.c include/block/blockjob_int.h tests/test-bdrv-drain.c +1 more+12 -141 reply
13/13blockjob: remove block_job_pause_point from interfaceblock/mirror.c blockjob.c include/block/blockjob_int.h+12 -111 reply

Reviews trailers per patch

7 of 13 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniStefan HajnocziJeff CodyMax Reitz
1/13
2/13R-b R-b R-b
3/13R-b
4/13
5/13R-b R-b
6/13R-b R-b
7/13R-b R-b
8/13R-b
9/13
10/13
11/13
12/13R-b
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 00/13] blockjob: refactor mirror_throttle

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(-)
Signature · 1 line
2.14.3