Skip to content
Development version of BFQ - Check the Wiki for branch descriptions
Branch: dev-bfq-on-5.2
Clone or download
Algodev-github block, bfq: check also in-flight I/O in dispatch plugging
Consider a sync bfq_queue Q that remains empty while in service, and
suppose that, when this happens, there is a fair amount of already
in-flight I/O not belonging to Q. In such a situation, I/O dispatching
may need to be plugged (until new I/O arrives for Q), for the
following reason.

The drive may decide to serve in-flight non-Q's I/O requests before
Q's ones, thereby delaying the arrival of new I/O requests for Q
(recall that Q is sync). If I/O-dispatching is not plugged, then,
while Q remains empty, a basically uncontrolled amount of I/O from
other queues may be dispatched too, possibly causing the service of
Q's I/O to be delayed even longer in the drive. This problem gets more
and more serious as the speed and the queue depth of the drive grow,
because, as these two quantities grow, the probability to find no
queue busy but many requests in flight grows too.

If Q has the same weight and priority as the other queues, then the
above delay is unlikely to cause any issue, because all queues tend to
undergo the same treatment. So, since not plugging I/O dispatching is
convenient for throughput, it is better not to plug. Things change in
case Q has a higher weight or priority than some other queue, because
Q's service guarantees may simply be violated. For this reason,
commit 1de0c4c ("block, bfq: reduce idling only in symmetric
scenarios") does plug I/O in such an asymmetric scenario. Plugging
minimizes the delay induced by already in-flight I/O, and enables Q to
recover the bandwidth it may lose because of this delay.

Yet the above commit does not cover the case of weight-raised queues,
for efficiency concerns. For weight-raised queues, I/O-dispatch
plugging is activated simply if not all bfq_queues are
weight-raised. But this check does not handle the case of in-flight
requests, because a bfq_queue may become non busy *before* all its
in-flight requests are completed.

This commit performs I/O-dispatch plugging for weight-raised queues if
there are some in-flight requests.

As a practical example of the resulting recover of control, under
write load on a Samsung SSD 970 PRO, gnome-terminal starts in 1.5
seconds after this fix, against 15 seconds before the fix (as a
reference, gnome-terminal takes about 35 seconds to start with any of
the other I/O schedulers).

Fixes: 1de0c4c ("block, bfq: reduce idling only in symmetric scenarios")
Signed-off-by: Paolo Valente <>
Latest commit e12e612 Jul 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Documentation dt-bindings: riscv: resolve 'make dt_binding_check' warnings Jun 26, 2019
LICENSES LICENSES: Rename other to deprecated May 3, 2019
arch Merge tag 'mips_fixes_5.2_2' of git://… Jul 6, 2019
block block, bfq: check also in-flight I/O in dispatch plugging Jul 18, 2019
certs treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 May 24, 2019
crypto Merge branch 'linus' of git://… Jul 5, 2019
drivers Merge tag 'dmaengine-fix-5.2' of git://… Jul 6, 2019
fs Merge branch 'fixes' of git://… Jul 6, 2019
include block, bfq: add logs and BUG_ONs Jul 15, 2019
init initramfs: fix populate_initrd_image() section mismatch Jun 29, 2019
ipc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 Jun 5, 2019
kernel ptrace: Fix ->ptracer_cred handling for PTRACE_TRACEME Jul 4, 2019
lib Merge branch 'linus' of git://… Jul 5, 2019
mm Revert "mm: page cache: store only head pages in i_pages" Jul 6, 2019
net Merge tag 'nfsd-5.2-2' of git:// Jul 6, 2019
samples samples: make pidfd-metadata fail gracefully on older kernels Jun 24, 2019
scripts treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 Jun 19, 2019
security Merge tag 'spdx-5.2-rc6' of git://… Jun 21, 2019
sound Merge tag 'sound-5.2' of git://… Jul 4, 2019
tools KVM: nVMX: Change KVM_STATE_NESTED_EVMCS to signal vmcs12 is copied f… Jul 2, 2019
usr user/Makefile: Fix typo and capitalization in comment section Dec 10, 2018
virt Merge tag 'spdx-5.2-rc6' of git://… Jun 21, 2019
.clang-format Merge git:// Apr 17, 2019
.cocciconfig scripts: add Linux .cocciconfig for coccinelle Jul 22, 2016
.get_maintainer.ignore Opt out of scripts/ May 16, 2019
.gitattributes .gitattributes: set git diff driver for C source code files Oct 8, 2016
.gitignore .gitignore: exclude .get_maintainer.ignore and .gitattributes May 18, 2019
.mailmap MAINTAINERS: Update my email address Jun 18, 2019
COPYING COPYING: use the new text with points to the license files Mar 23, 2018
CREDITS MAINTAINERS: Farewell Martin Schwidefsky May 31, 2019
Kbuild Merge tag 'kbuild-v5.1' of git://… Mar 11, 2019
Kconfig kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt Aug 1, 2018
MAINTAINERS Merge tag 'mips_fixes_5.2_2' of git://… Jul 6, 2019
Makefile Linux 5.2 Jul 7, 2019
README Drop all 00-INDEX files from Documentation/ Sep 9, 2018


Linux kernel

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
You can’t perform that action at this time.