diff options
author | Jens Axboe <axboe@suse.de> | 2005-06-28 10:35:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-28 17:56:50 -0400 |
commit | 082cf69eb82681f4eacb3a5653834c7970714bef (patch) | |
tree | a0817817c787a89abd0eb7e5bf6f217523060b63 /drivers/block/ll_rw_blk.c | |
parent | f8b58edf3acf0dcc186b8330939000ecf709368a (diff) |
[PATCH] ll_rw_blk: prevent huge request allocations
Currently we cap request allocations at q->nr_requests, but we allow a
batching io context to allocate up to 32 more (default setting). This
can flood the queue with request allocations, with only a few batching
processes. The real fix would be to limit the number of batchers, but
as that isn't currently tracked, I suggest we just cap the maximum
number of allocated requests to eg 50% over the limit.
This was observed in real life, users typically see this as vmstat bo
numbers going off the wall with seconds of no queueing afterwards.
Behaviour this bursty is not beneficial.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/ll_rw_blk.c')
-rw-r--r-- | drivers/block/ll_rw_blk.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 234fdcfbdf0..6c98cf04271 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -1912,6 +1912,15 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, | |||
1912 | } | 1912 | } |
1913 | 1913 | ||
1914 | get_rq: | 1914 | get_rq: |
1915 | /* | ||
1916 | * Only allow batching queuers to allocate up to 50% over the defined | ||
1917 | * limit of requests, otherwise we could have thousands of requests | ||
1918 | * allocated with any setting of ->nr_requests | ||
1919 | */ | ||
1920 | if (rl->count[rw] >= (3 * q->nr_requests / 2)) { | ||
1921 | spin_unlock_irq(q->queue_lock); | ||
1922 | goto out; | ||
1923 | } | ||
1915 | rl->count[rw]++; | 1924 | rl->count[rw]++; |
1916 | rl->starved[rw] = 0; | 1925 | rl->starved[rw] = 0; |
1917 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) | 1926 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) |