Skip to content

cfq-iosched: Fair cross-group preemption

Chad Talbott lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3cfq-iosched: Fair cross-group preemption (interface and documentation)Documentation/cgroups/blkio-controller.txt block/blk-cgroup.c block/blk-cgroup.h +1 more+145 -402 replies
2/3cfq-iosched: Fair cross-group preemption (implementation)block/cfq-iosched.c+38 -30 replies
3/3cfq-iosched: Fair cross-group preemption (stats)block/blk-cgroup.c block/blk-cgroup.h block/cfq-iosched.c+81 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] cfq-iosched: Fair cross-group preemption

This patchset introduces fair cross-group preemption. Right now, we don't have strict isolation between processes in different cgroups. For example: currently an RT ioprio thread in one group can preempt a BE ioprio thread in another group. We would like to have an application specify the relative priorities of its threads, but still allow strict isolation between applications.

With this patch series, we can configure an entire cgroup as needing low-latency service. Then that group will be able to preempt another group. To prevent a runaway application from starving other applications, we allow this preemption only until it has exceeded its fair share (as specified by its relative weight). So a rate-limited, but latency sensative application (like streaming audio or video) can get front-of-the-line service without fear of it hogging a whole disk's IO.

Note that this series is targeted to shallow-queue devices (e.g. a single spinning disk). Without hardware support, it is much more difficult to provide low-latency on a device with a deep request queue.

The following bash script demonstrates the feature:

cd /dev/cgroup
mkdir c1 c2

(
echo '8:16 900' > c1/blkio.weight_device
echo '8:16 2' > c1/blkio.class
echo $BASHPID > c1/tasks
dd if=/dev/sdb of=/dev/null bs=1M iflag=direct
) &
(
echo '8:16 100' > c2/blkio.weight_device
echo '8:16 1' > c2/blkio.class
echo $BASHPID > c2/tasks
while : ; do dd if=/dev/sdb of=/dev/null bs=1M count=1 iflag=direct; sleep .1 ; done
) &
sleep 10
kill %1 %2

grep 8:16 c?/blkio*

# end

Since the c2 reader is "well behaved" and only reads 10MB/s, it will be able to consistenly preempt c1, and therefore see low latency for its requests.