disable I/O priority when prio_aging_expire is zero - #1158
disable I/O priority when prio_aging_expire is zero#1158blktests-ci-kpd[bot] wants to merge 3 commits into
Conversation
|
Upstream branch: bd5f485 |
3df366e to
5dd70cb
Compare
|
Upstream branch: 66498c7 |
4110d37 to
0219e15
Compare
5dd70cb to
055a766
Compare
|
Upstream branch: 502d457 |
0219e15 to
b4f4a44
Compare
055a766 to
341ae8c
Compare
|
Upstream branch: cf72cbb |
b4f4a44 to
be54a48
Compare
341ae8c to
940e422
Compare
|
Upstream branch: cee9395 |
be54a48 to
2e1e0c4
Compare
940e422 to
3cab524
Compare
|
Upstream branch: 89a3129 |
2e1e0c4 to
06062d0
Compare
3cab524 to
8242bf1
Compare
|
Upstream branch: bc35965 |
06062d0 to
9660b6c
Compare
8242bf1 to
5b28f57
Compare
|
Upstream branch: df29080 Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/series/1148773/ conflict: |
5b28f57 to
4ddd216
Compare
|
Upstream branch: 28924df |
9660b6c to
c5622d9
Compare
4ddd216 to
00cc4ca
Compare
Since the mq-deadline scheduler introduced support for I/O priorities,
if a process does not have an I/O priority configured, it becomes bound
to the process's scheduling priority. This change forces applications to
re-plan their I/O priorities. However, applications do not care about I/O
priorities, yet now they cannot disable priorities.
Setting prio_aging_expire to zero does not actually turn off I/O
priority in mq-deadline. Instead the priority aging path in
dd_dispatch_prio_aged_requests() is invoked with "now - 0 == now",
which causes best-effort and idle requests to be dispatched ahead of
pending real-time requests through the aging path -- a classic
priority inversion, not the "priority disabled" behavior users expect
when writing zero.
Treat a zero prio_aging_expire as an explicit request to disable I/O
priority:
* dd_insert_request() and dd_request_merge() file every request in
the DD_BE_PRIO bucket, so the scheduler no longer distinguishes
between RT, BE and IDLE classes.
* dd_dispatch_prio_aged_requests() short-circuits when
prio_aging_expire is zero, closing the aging path that caused the
inversion.
* dd_request_merged() and dd_merged_requests() now look up the
per-priority bucket from rq->elv.priv[0] instead of recomputing it
from the request ioprio. Once priority is disabled the request
ioprio no longer reflects the bucket the request lives in, so the
old computation would touch the wrong rb-tree and FIFO list.
Switching the mode while I/O is in flight could itself invert
priorities, because requests already queued in the RT or IDLE buckets
would keep being dispatched by priority until they drain. Follow the
same sequence used by elevator_switch(): when the sysfs store observes
a transition from a non-zero value to zero it freezes the queue (which
blocks new upper-layer I/O in blk_queue_enter() and waits for every
outstanding request to complete, draining the scheduler), quiesces the
queue so that no dispatch is in progress, flips prio_aging_expire to
zero, then unquiesces and unfreezes. New I/O arriving after the
switch lands in the best-effort bucket. Writing a non-zero value
re-enables priority without draining.
Signed-off-by: Ye Bin <yebin10@huawei.com>
Allow the default value of prio_aging_expire to be overridden at load time, in milliseconds to match the sysfs attribute: - built-in: mq_deadline.prio_aging_expire=0 on the kernel command line - module: modprobe mq_deadline prio_aging_expire=0 A value of zero disables I/O priority from boot/load: every request is filed in the best-effort bucket and the priority aging path is bypassed, so systems that do not want RT/BE/IDLE distinction can opt out without writing to sysfs after every queue creation. Previously prio_aging_expire was a compile-time constant (10 * HZ) with no way to change the default before the first request queue was initialized. Make the variable a module_param so that the override works whether mq-deadline is built-in or compiled as a module, and convert the millisecond value to jiffies in dd_init_sched() when assigning the per-queue default. Signed-off-by: Ye Bin <yebin10@huawei.com>
|
Upstream branch: 893e117 |
c5622d9 to
c50fdfb
Compare
00cc4ca to
7efd8cd
Compare
Pull request for series with
subject: disable I/O priority when prio_aging_expire is zero
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1148773