From: Shaohua Li Date: Tue, 3 Nov 2009 19:25:02 +0000 (+0100) Subject: cfq-iosched: limit coop preemption X-Git-Tag: v2.6.32-rc7~80^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b27e1bb442e964903f8a3fa6bdf33a602dc0941;p=pandora-kernel.git 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 Acked-by: Jeff Moyer Signed-off-by: Jens Axboe --- Reading git-diff-tree failed