]> git.baikalelectronics.ru Git - kernel.git/commit
cfq-iosched: limit coop preemption
authorShaohua Li <shaohua.li@intel.com>
Tue, 3 Nov 2009 19:25:02 +0000 (20:25 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 3 Nov 2009 19:25:02 +0000 (20:25 +0100)
commit0bbeaa39d0cad93ee07529906593444502ab3d26
treed7eecb66f6a75dbff292fbd03b643b04ed075289
parent5b1581f8e07fb4e2ec5b081382b0106f779bc430
cfq-iosched: limit coop preemption

CFQ has an optimization for cooperated applications. if several
io-context have close requests, they will get boost. But the
optimization get abused. Considering thread a, b, which work on one
file. a reads sectors s, s+2, s+4, ...; b reads sectors s+1, s+3, s
+5, ... Both a and b are sequential read, so they can open idle window.
a reads a sector s and goes to idle window and wakeup b. b reads sector
s+1, since in current implementation, cfq_should_preempt() thinks a and
b are cooperators, b will preempt a. b then reads sector s+1 and goes to
idle window and wakeup a. for the same reason, a will preempt b and
reads s+2. a and b will continue the circle. The circle will be very
long, and a and b will occupy whole disk queue. Other applications will
nearly have no chance to run.

Fix this limiting coop preempt until a queue is scheduled normally
again.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/cfq-iosched.c