Recent changes (master)
The following changes since commit e68470637ae7c03d5f85a9243e148d7c46ad4487:
Update the year to 2020 in os/windows/eula.rtf (2020-08-29 18:54:17 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 20c7a244e75e4aa705a31a74e7067de4c890dff7:
options: flow should parse as FIO_OPT_INT (2020-08-31 09:07:12 -0600)
----------------------------------------------------------------
David, Bar (2):
flow: reclaim flow when job is reaped
flow: add ability for weight-based flow control on multiple jobs
Jens Axboe (2):
Merge branch 'multi_job_flow' of https://github.com/bardavid/fio into master
options: flow should parse as FIO_OPT_INT
HOWTO | 9 +--- arch/arch.h | 7 +++ backend.c | 1 + cconv.c | 6 +-- examples/butterfly.fio | 2 +- examples/flow.fio | 5 +- fio.1 | 23 ++++---- fio.h | 1 + flow.c | 50 ++++++++++++------ flow.h | 2 + options.c | 10 +--- server.h | 2 +- t/jobs/t0011-5d2788d5.fio | 4 +- t/jobs/t0012.fio | 23 ++++---- t/jobs/t0014.fio | 29 +++++++++++ t/run-fio-tests.py | 130 ++++++++++++++++++++++++++++++++++++++++++++-- thread_options.h | 24 +++++---- 17 files changed, 250 insertions(+), 78 deletions(-) create mode 100644 t/jobs/t0014.fio
---
Diff of recent changes:
HOWTO +2 -7
@@ -2861,15 +2861,10 @@ Threads, processes and job synchronization ``flow=8`` and another job has ``flow=-1``, then there will be a roughly 1:8 ratio in how much one runs vs the other. -.. option:: flow_watermark=int - - The maximum value that the absolute value of the flow counter is allowed to - reach before the job must wait for a lower value of the counter. - .. option:: flow_sleep=int - The period of time, in microseconds, to wait after the flow watermark has - been exceeded before retrying operations. + The period of time, in microseconds, to wait after the flow counter + has exceeded its proportion before retrying operations. .. option:: stonewall, wait_for_previous
arch/arch.h +7 -0
@@ -36,6 +36,13 @@ extern unsigned long arch_flags;#define ARCH_CPU_CLOCK_WRAPS +#define atomic_add (p, v) \ + atomic_fetch_add((_Atomic typeof(*(p)) *)(p), v) +#define atomic_sub (p, v) \ + atomic_fetch_sub((_Atomic typeof(*(p)) *)(p), v) +#define atomic_load_relaxed (p) \ + atomic_load_explicit((_Atomic typeof(*(p)) *)(p), \ + memory_order_relaxed)#define atomic_load_acquire (p) \ atomic_load_explicit((_Atomic typeof(*(p)) *)(p), \ memory_order_acquire)
backend.c +1 -0
@@ -2042,6 +2042,7 @@ reaped: done_secs +=mtime_since_now (&td->epoch) /1000 ;profile_td_exit (td); +flow_exit_job (td); }if (*nr_running == cputhreads && !pending && realthreads)
cconv.c +2 -4
@@ -281,8 +281,7 @@ void convert_thread_options_to_cpu(struct thread_options *o, o->uid =le32_to_cpu (top->uid); o->gid =le32_to_cpu (top->gid); o->flow_id =__le32_to_cpu (top->flow_id); - o->flow =__le32_to_cpu (top->flow); - o->flow_watermark =__le32_to_cpu (top->flow_watermark); + o->flow =le32_to_cpu (top->flow); o->flow_sleep =le32_to_cpu (top->flow_sleep); o->sync_file_range =le32_to_cpu (top->sync_file_range); o->latency_target =le64_to_cpu (top->latency_target);
@@ -481,8 +480,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->uid =cpu_to_le32 (o->uid); top->gid =cpu_to_le32 (o->gid); top->flow_id =__cpu_to_le32 (o->flow_id); - top->flow =__cpu_to_le32 (o->flow); - top->flow_watermark =__cpu_to_le32 (o->flow_watermark); + top->flow =cpu_to_le32 (o->flow); top->flow_sleep =cpu_to_le32 (o->flow_sleep); top->sync_file_range =cpu_to_le32 (o->sync_file_range); top->latency_target =__cpu_to_le64 (o->latency_target);
examples/butterfly.fio +1 -1
@@ -15,5 +15,5 @@ flow=2 [backward] rw=read:-8k -flow=-2 +flow=2 #offset=50%
examples/flow.fio +2 -3
@@ -11,15 +11,14 @@ iodepth=256 size=100g bs=8k filename=/tmp/testfile -flow_watermark=100 flow_sleep=1000 [job2] numjobs=1 rw=write -flow=-8 +flow=1 [job1] numjobs=1 rw=randread -flow=1 +flow=8
fio.1 +10 -13
@@ -2549,21 +2549,18 @@ The ID of the flow. If not specified, it defaults to being a global flow. See \fBflow\fR. .TP .BI flow \fR=\fPint -Weight in token-based flow control. If this value is used, then there is -a 'flow counter' which is used to regulate the proportion of activity between -two or more jobs. Fio attempts to keep this flow counter near zero. The -\fBflow\fR parameter stands for how much should be added or subtracted to the -flow counter on each iteration of the main I/O loop. That is, if one job has -`flow=8' and another job has `flow=\-1', then there will be a roughly 1:8 -ratio in how much one runs vs the other. -.TP -.BI flow_watermark \fR=\fPint -The maximum value that the absolute value of the flow counter is allowed to -reach before the job must wait for a lower value of the counter. +Weight in token-based flow control. If this value is used, +then fio regulates the activity between two or more jobs +sharing the same flow_id. +Fio attempts to keep each job activity proportional to other jobs' activities +in the same flow_id group, with respect to requested weight per job. +That is, if one job has `flow=3', another job has `flow=2' +and another with `flow=1`, then there will be a roughly 3:2:1 ratio +in how much one runs vs the others. .TP .BI flow_sleep \fR=\fPint -The period of time, in microseconds, to wait after the flow watermark has -been exceeded before retrying operations. +The period of time, in microseconds, to wait after the flow counter +has exceeded its proportion before retrying operations. .TP .BI stonewall "\fR,\fB wait_for_previous" Wait for preceding jobs in the job file to exit, before starting this
fio.h +1 -0
@@ -440,6 +440,7 @@ struct thread_data {int first_error;struct fio_flow *flow; +unsigned long long flow_counter;/* * Can be overloaded by profiles
flow.c +35 -15
103 lines not on this page · raw message
flow.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_FLOW_H #define FIO_FLOW_H +#define FLOW_MAX_WEIGHT 1000 +int flow_threshold_exceeded (struct thread_data *td);void flow_init_job (struct thread_data *td);void flow_exit_job (struct thread_data *td);
options.c +2 -8
@@ -4702,20 +4702,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .parent = "flow_id", .hide = 1, .def = "0", + .maxval = FLOW_MAX_WEIGHT, .category = FIO_OPT_C_IO, .group = FIO_OPT_G_IO_FLOW, }, { .name = "flow_watermark", .lname = "I/O flow watermark", - .type = FIO_OPT_INT, - .off1 = offsetof(struct thread_options, flow_watermark), - .help ="High watermark for flow control. This option" -" should be set to the same value for all threads" - " with non-zero flow.", - .parent = "flow_id", - .hide = 1, - .def = "1024", + .type = FIO_OPT_SOFT_DEPRECATED, .category = FIO_OPT_C_IO, .group = FIO_OPT_G_IO_FLOW, },
server.h +1 -1
@@ -48,7 +48,7 @@ struct fio_net_cmd_reply { };enum { -FIO_SERVER_VER =84 , +FIO_SERVER_VER =85 ,FIO_SERVER_MAX_FRAGMENT_PDU =1024 ,FIO_SERVER_MAX_CMD_MB =2048 ,
t/jobs/t0011-5d2788d5.fio +2 -2
@@ -11,8 +11,8 @@ runtime=10 flow_id=1 [flow1] -flow=-8 +flow=1 rate_iops=1000 [flow2] -flow=1 +flow=8
t/jobs/t0012.fio +14 -9
@@ -1,20 +1,25 @@ -# Expected results: no parse warnings, runs and with roughly 1/8 iops between -# the two jobs. -# Buggy result: parse warning on flow value overflow, no 1/8 division between -# jobs. +# Expected results: no parse warnings, runs and with roughly 1:5:10 iops +# between the three jobs. +# Buggy result: parse warning on flow value overflow, no 1:5:10 division +# between jobs. # [global] bs=4k ioengine=null size=100g -runtime=10 +runtime=12 flow_id=1 -gtod_cpu=1 +flow_sleep=100 +thread +log_avg_msec=1000 +write_iops_log=t0012.fio [flow1] -flow=-8 -rate_iops=1000 +flow=1 [flow2] -flow=1 +flow=5 + +[flow3] +flow=10
t/jobs/t0014.fio new file +29 -0
@@ -0,0 +1,29 @@ +# Expected results: no parse warnings, runs and with roughly 1:2:3 iops +# between the three jobs for the first 5 seconds, then +# runs with roughly 1:2 iops between the two jobs for +# the remaining 5 seconds. +# +# Buggy result: parse warning on flow value overflow, no 1:2:3 division between +# the three jobs for the first 5 seconds or no 1:2 division between +# the first two jobs for the remaining 5 seconds. +# + +[global] +bs=4k +ioengine=null +size=100g +runtime=12 +flow_id=1 +thread +log_avg_msec=1000 +write_iops_log=t0014.fio + +[flow1] +flow=1 + +[flow2] +flow=2 + +[flow3] +flow=3 +runtime=5
t/run-fio-tests.py +125 -5
159 lines not on this page · raw message
thread_options.h +14 -10
@@ -311,11 +311,6 @@ struct thread_options {unsigned int uid;unsigned int gid; -int flow_id; -int flow; -int flow_watermark; -unsigned int flow_sleep; -unsigned int offset_increment_percent;unsigned long long offset_increment;unsigned long long number_ios;
@@ -327,6 +322,13 @@ struct thread_options {fio_fp64_t latency_percentile;uint32_t latency_run; +/* +* flow support +*/ +int flow_id; +unsigned int flow; +unsigned int flow_sleep; +unsigned int sig_figs;unsigned block_error_hist;
@@ -602,11 +604,6 @@ struct thread_options_pack {uint32_t uid;uint32_t gid; -int32_t flow_id; -int32_t flow; -int32_t flow_watermark; -uint32_t flow_sleep; -uint32_t offset_increment_percent;uint64_t offset_increment;uint64_t number_ios;
@@ -617,6 +614,13 @@ struct thread_options_pack {fio_fp64_t latency_percentile;uint32_t latency_run; +/* +* flow support +*/ +int32_t flow_id; +uint32_t flow; +uint32_t flow_sleep; +uint32_t sig_figs;uint32_t block_error_hist;