Skip to content

disable I/O priority when prio_aging_expire is zero - #1158

Open
blktests-ci-kpd[bot] wants to merge 3 commits into
linus-master_basefrom
series/1148773=>linus-master
Open

disable I/O priority when prio_aging_expire is zero#1158
blktests-ci-kpd[bot] wants to merge 3 commits into
linus-master_basefrom
series/1148773=>linus-master

Conversation

@blktests-ci-kpd

Copy link
Copy Markdown

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

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: bd5f485
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 66498c7
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from 4110d37 to 0219e15 Compare August 25, 2026 03:42
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 502d457
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from 0219e15 to b4f4a44 Compare August 26, 2026 20:51
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: cf72cbb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from b4f4a44 to be54a48 Compare August 29, 2026 07:02
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: cee9395
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from be54a48 to 2e1e0c4 Compare August 31, 2026 10:51
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 89a3129
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from 2e1e0c4 to 06062d0 Compare September 2, 2026 09:22
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: bc35965
series: https://patchwork.kernel.org/project/linux-block/list/?series=1148773
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from 06062d0 to 9660b6c Compare September 4, 2026 06:36
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: df29080
series: https://patchwork.kernel.org/series/1148773/
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/series/1148773/
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:


@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 28924df
series: https://patchwork.kernel.org/series/1148773/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from 9660b6c to c5622d9 Compare September 8, 2026 16:06
Ye Bin added 2 commits September 9, 2026 08:23
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>
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 893e117
series: https://patchwork.kernel.org/series/1148773/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1148773=>linus-master branch from c5622d9 to c50fdfb Compare September 9, 2026 08:23
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