Skip to content

Commit e21b7a0

Browse files
ariavaaxboe
authored andcommitted
block, bfq: add full hierarchical scheduling and cgroups support
Add complete support for full hierarchical scheduling, with a cgroups interface. Full hierarchical scheduling is implemented through the 'entity' abstraction: both bfq_queues, i.e., the internal BFQ queues associated with processes, and groups are represented in general by entities. Given the bfq_queues associated with the processes belonging to a given group, the entities representing these queues are sons of the entity representing the group. At higher levels, if a group, say G, contains other groups, then the entity representing G is the parent entity of the entities representing the groups in G. Hierarchical scheduling is performed as follows: if the timestamps of a leaf entity (i.e., of a bfq_queue) change, and such a change lets the entity become the next-to-serve entity for its parent entity, then the timestamps of the parent entity are recomputed as a function of the budget of its new next-to-serve leaf entity. If the parent entity belongs, in its turn, to a group, and its new timestamps let it become the next-to-serve for its parent entity, then the timestamps of the latter parent entity are recomputed as well, and so on. When a new bfq_queue must be set in service, the reverse path is followed: the next-to-serve highest-level entity is chosen, then its next-to-serve child entity, and so on, until the next-to-serve leaf entity is reached, and the bfq_queue that this entity represents is set in service. Writeback is accounted for on a per-group basis, i.e., for each group, the async I/O requests of the processes of the group are enqueued in a distinct bfq_queue, and the entity associated with this queue is a child of the entity associated with the group. Weights can be assigned explicitly to groups and processes through the cgroups interface, differently from what happens, for single processes, if the cgroups interface is not used (as explained in the description of the previous patch). In particular, since each node has a full scheduler, each group can be assigned its own weight. Signed-off-by: Fabio Checconi <[email protected]> Signed-off-by: Paolo Valente <[email protected]> Signed-off-by: Arianna Avanzini <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent aee69d7 commit e21b7a0

File tree

4 files changed

+2213
-384
lines changed

4 files changed

+2213
-384
lines changed

Documentation/block/bfq-iosched.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,14 @@ of slice_idle are copied from CFQ too.
253253
per-process ioprio and weight
254254
-----------------------------
255255

256-
Unless the cgroups interface is used, weights can be assigned to
257-
processes only indirectly, through I/O priorities, and according to
258-
the relation: weight = (IOPRIO_BE_NR - ioprio) * 10.
256+
Unless the cgroups interface is used (see "4. BFQ group scheduling"),
257+
weights can be assigned to processes only indirectly, through I/O
258+
priorities, and according to the relation:
259+
weight = (IOPRIO_BE_NR - ioprio) * 10.
260+
261+
Beware that, if low-latency is set, then BFQ automatically raises the
262+
weight of the queues associated with interactive and soft real-time
263+
applications. Unset this tunable if you need/want to control weights.
259264

260265
slice_idle
261266
----------
@@ -450,9 +455,9 @@ may be reactivated for an already busy async queue (in ms).
450455
4. Group scheduling with BFQ
451456
============================
452457

453-
BFQ supports both cgroup-v1 and cgroup-v2 io controllers, namely blkio
454-
and io. In particular, BFQ supports weight-based proportional
455-
share.
458+
BFQ supports both cgroups-v1 and cgroups-v2 io controllers, namely
459+
blkio and io. In particular, BFQ supports weight-based proportional
460+
share. To activate cgroups support, set BFQ_GROUP_IOSCHED.
456461

457462
4-1 Service guarantees provided
458463
-------------------------------

block/Kconfig.iosched

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ config CFQ_GROUP_IOSCHED
4040
Enable group IO scheduling in CFQ.
4141

4242
choice
43+
4344
prompt "Default I/O scheduler"
4445
default DEFAULT_CFQ
4546
help
@@ -89,6 +90,15 @@ config IOSCHED_BFQ
8990
real-time applications. Details in
9091
Documentation/block/bfq-iosched.txt
9192

93+
config BFQ_GROUP_IOSCHED
94+
bool "BFQ hierarchical scheduling support"
95+
depends on IOSCHED_BFQ && BLK_CGROUP
96+
default n
97+
---help---
98+
99+
Enable hierarchical scheduling in BFQ, using the blkio
100+
(cgroups-v1) or io (cgroups-v2) controller.
101+
92102
endmenu
93103

94104
endif

0 commit comments

Comments
 (0)