Skip to content

block/mq-deadline: add prio_enable switch and harden prio_aging_expire - #1245

Open
blktests-ci[bot] wants to merge 4 commits into
for-next_basefrom
series/1154425=>for-next
Open

block/mq-deadline: add prio_enable switch and harden prio_aging_expire#1245
blktests-ci[bot] wants to merge 4 commits into
for-next_basefrom
series/1154425=>for-next

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block/mq-deadline: add prio_enable switch and harden prio_aging_expire
version: 2
url: https://patchwork.kernel.org/series/1154425/

@blktests-ci

blktests-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: ba285ed
series: https://patchwork.kernel.org/series/1154425/
version: 2

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/series/1154425/
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To record the empty patch as an empty commit, run "git am --allow-empty".
To restore the original branch and stop patching, run "git am --abort".'

conflict:


Ye Bin added 4 commits September 8, 2026 15:49
A prio_aging_expire of zero does not disable 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 -- a classic priority inversion, not the
"priority disabled" behavior users may expect when writing zero.

Reject zero (and negative) values in the sysfs store with -EINVAL so
that a misconfiguration is reported rather than silently accepted.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Since mq-deadline introduced support for I/O priorities, processes
without an explicit I/O priority are bound to their scheduling
priority.  This forces applications to plan their I/O priorities,
but many applications do not care about I/O priorities and have no
way to disable the distinction.

Add a per-queue prio_enable boolean to control whether I/O priority
(RT/BE/IDLE) support is active.  When disabled, every request is
filed in the best-effort bucket and the priority aging path is
bypassed.

To avoid priority inversion while toggling the switch at runtime,
the sysfs store follows the same sequence as elevator_switch():
freeze the queue, quiesce, flip the flag, then unquiesce and
unfreeze.  This drains in-flight I/O so that requests already queued
in RT or IDLE buckets complete before the mode changes.

Since requests may now be filed in a bucket that does not match
their ioprio, update dd_start_request(), dd_request_merged() and
dd_merged_requests() to look up the per-priority bucket from
rq->elv.priv[0] instead of recomputing it from the request ioprio.
Remove the now-unused dd_rq_ioclass() helper.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Allow the default of prio_enable to be overridden at load time:

  - built-in:  mq_deadline.prio_enable=0 on the kernel command line
  - module:    modprobe mq_deadline prio_enable=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.

Signed-off-by: Ye Bin <yebin10@huawei.com>
…osched

The mq-deadline scheduler exposes two sysfs tunables, prio_enable and
prio_aging_expire, that control its I/O priority (RT/BE/IDLE) support,
but neither was described in the deadline-iosched documentation.

Add sections covering:

  - prio_enable: enables/disables RT/BE/IDLE distinction; when disabled
    all requests fall into the best-effort bucket and the priority aging
    path is bypassed.  Switching the value drains in-flight I/O (queue
    freeze and quiesce) to avoid priority inversion during the transition.
    Also available as a module parameter.

  - prio_aging_expire: the time after which a waiting best-effort or idle
    request may be dispatched despite pending real-time requests, to
    prevent indefinite starvation.  Defaults to 10000 ms; only effective
    when prio_enable is on and at least two priority buckets are
    populated.  Zero and negative values are rejected with -EINVAL to
    avoid the "now - 0 == now" priority inversion.

Signed-off-by: Ye Bin <yebin10@huawei.com>
@blktests-ci

blktests-ci Bot commented Sep 8, 2026

Copy link
Copy Markdown
Author

Upstream branch: ba285ed
series: https://patchwork.kernel.org/series/1154425/
version: 2

@blktests-ci
blktests-ci Bot force-pushed the series/1154425=>for-next branch from 38d2064 to c7504ee Compare September 8, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants