Browse files

block: introduce the BFQ I/O scheduler

Add the BFQ-v1-r1 I/O scheduler to 2.6.35.
The general structure is borrowed from CFQ, as much of the code. A (bfq_)queue
is associated to each task doing I/O on a device, and each time a scheduling
decision has to be taken a queue is selected and it is served until it expires.

The main differences are:
     - slices are given in the service domain: tasks are assigned budgets,
       measured in number of sectors. Once got the disk, a task must
       however consume its assigned budget within a configurable maximum time
       (by default, the maximum possible value of the budgets is automaticall
       computed to comply with this timeout). This allows the desired latency
       vs "throughput boosting" tradeoff to be set.

    - Budgets are scheduled according to a variant of WF2Q+, implemented
      using an augmented rb-tree to take eligibility into account while
      preserving an O(log N) overall complexity.

    - BFQ supports full hierarchical scheduling, exporting a cgroups
      interface.  Each node has a full scheduler, so each group can
      be assigned its own ioprio and an ioprio_class.

    - If the cgroups interface is used, weights can be explictly assigned,
      otherwise ioprio values are mapped to weights using the relation
      weight = IOPRIO_BE_NR - ioprio.

    - ioprio classes are served in strict priority order, i.e., lower
      priority queues are not served as long as there are higher priority
      queues.  Among queues in the same classes the bandwidth is distributed
      in proportion to the weights of each queue.

Regarding what has not changed it is worth noting:
    - the handling of cfq_io_contexts to associate queues to tasks.
      of the code has been reused just renaming it.  (There is room for
      code sharing with CFQ but we wanted to minimize the impact of this

    - The handling of async queues.

    - The handling of idle windows.

    - The handling of merging.

    - The heuristics to assert that a task is worth an idle window (with
      minor modifications to hw_tag/CIC_SEEKY detection).

Signed-off-by: Fabio Checconi <>
Signed-off-by: Paolo Valente <>

Ported the following commits to bfq:
    - cfq-iosched: compact io_context radix_tree (80b15c7)
    - cfq-iosched: remove dead_key from cfq_io_context (bca4b91)
  • Loading branch information...
1 parent cfe67b5 commit f3c0e5f74bf9f0db516c3bd6633254104841b428 @paolo-github paolo-github committed with rmcc Jul 2, 2010
Showing with 5,021 additions and 0 deletions.
  1. +767 −0 block/bfq-cgroup.c
  2. +374 −0 block/bfq-ioc.c
  3. +2,312 −0 block/bfq-iosched.c
  4. +1,010 −0 block/bfq-sched.c
  5. +558 −0 block/bfq.h
Oops, something went wrong.

0 comments on commit f3c0e5f

Please sign in to comment.