[PATCH -mm 0/6] cgroup: block device i/o controller (v11)

Andrea Righi righi.andrea at gmail.com
Mon Nov 10 00:51:54 PST 2008


On 2008-11-03 08:01, Gui Jianfeng wrote:
> Hi Andrea,
> 
> I'v tested io-throttle(v11), it seems io-throttle doesn't work well 
> when a process writes(delay-write) a small file(<50M may be). it can't 
> throttle the request process accurately.
> I guess the following reason causes this problem.
> The write-request process terminates too early to see all accounting
> calculated in pdflush. So io-throttle can't throttle
> enough time for that process. Am i right?

Hi Gui,

sorry for my late first of all. You're right in part. The fact is that
with asynchronous IO (no O_DIRECT more exactly) the accounting is
performed when the blocks are submitted to the IO subsystem (submit_bio)
and the throttling is performed post-facto when the same process or the
other processes in the same cgroup write additional pages mapped to the
limited device (throttling is performed in
balance_dirty_pages_ratelimited_nr).

Anyway, if the process did a single small write in memory the operation
is not accounted until pdflush writes the data back to the block device.
When pdflush (or the process itself) performs the writeback the
operation is accounted and next reads/writes that come from the same
cgroup can now be throttled according to the defined limits.

So, the accounting is not lost, this information is only used later to
throttle the next operations that will cause IO requests. IO spikes in
this way are not prevented. With an early version of io-throttle I did
both throttling and accounting in balance_dirty_pages_ratelimited_nr
(when pages are written to memory), this can prevent IO spikes, but only
if dirty_ratio is set to small values.

Hope this clarify,
-Andrea


More information about the Containers mailing list