Skip to content
Snippets Groups Projects
Commit de83169b authored by Glauber Costa's avatar Glauber Costa Committed by Pekka Enberg
Browse files

blkfront: limit the size of the blkfront queue


I have previously seen situations in which we had a lot more requests than we
can handle, leading to an OOM. I've initially thought that this was because
since there are only max_requests (usually 32) requests, new requests would
overwrite the old bio queue, leading to some of the bio_done functions never
being called.

A closer look at the code was enough to show me wrong, since at the end of the
ring consumption, we do iterate over old requests, processing them.

The real problem then, is that we can generate memory a lot faster than we can
process disk IO. To give an idea about order of magnitude, when a spike would
happen in Xen block (the very problem I am tracking), causing processing to be
interrupted by ~1s, 18k requests would accumulate in the queue. Since after
draining the ring we can only requeue 32 new requests, the end result is that
the 18k requests are never really processed. And at the new spike, 18k more
sit, and so on.

The solution is to adopt a strategy similar to virtio. We'll add a condition
variable to the queue and block new requests while we are processing new ones.

With this patch applied, misc-bdev-write.so runs to completion, but
unfortunately still quite slow.

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 164034ee
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment