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

From: Chad Talbott
Date: Mon Mar 21 2011 - 21:11:09 EST

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

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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/