Re: Block device throttling [Re: Distributed storage.]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Evgeniy Polyakov
Date: Monday, August 13, 2007 - 5:18 am

On Mon, Aug 13, 2007 at 04:18:03AM -0700, Daniel Phillips (phillips@phunq.net) wrote:

No. You get one slot, and one thread will not be blocked, all others
will. If lucky thread wants to put two requests it will be blocked on
second request, since underlying physical device does not accept requests
anymore an thus caller will sleep.


Each thread will sleep in generic_make_request(), if limit is specified
correctly, then allocated number of bios will be enough to have a
progress.

Here is an example:

let's say system has 20.000 pages in RAM and 20.000 in swap,
we have 8.000 threads, each one allocates a page, then next page and so
on. System has one virtual device with two physical devices under it,
each device gets half of requests.

We set limit to 4.000 per physical device.

All threads allocate a page and queue it to devices, so all threads
succeeded in its first allocation, and each device has its queue full.
Virtual device does not have a limit (or have it 4.000 too, but since it
was each time recharged, it has zero blocks in-flight).

New thread tries to allocate a page, it is allocated and queued to one
of the devices, but since its queue is full, thread sleeps. So will do
each other.

Thus we ended up allocated 8.000 requests queued, and 8.000 in-flight,
totally 16.000 which is smaller than amount of pages in RAM, so we are
happy.

Consider above as a special kind calculation i.e. number of 
_allocated_ pages is always number of physical device multiplied by each
one's in-flight limit. By adjusting in-flight limit and knowing number
of device it is completely possible to eliminate vm deadlock.

If you do not like such calculation, solution is trivial:
we can sleep _after_ ->make_request_fn() in
generic_make_request() until number of in-flight bios is reduced by
bio_endio().

-- 
	Evgeniy Polyakov
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Distributed storage., Evgeniy Polyakov, (Tue Jul 31, 10:13 am)
Re: Distributed storage., Daniel Phillips, (Thu Aug 2, 2:08 pm)
Re: Distributed storage., Mike Snitzer, (Thu Aug 2, 9:09 pm)
Re: Distributed storage., Manu Abraham, (Thu Aug 2, 10:04 pm)
Re: Distributed storage., Evgeniy Polyakov, (Fri Aug 3, 3:26 am)
Re: Distributed storage., Evgeniy Polyakov, (Fri Aug 3, 3:42 am)
Re: Distributed storage., Evgeniy Polyakov, (Fri Aug 3, 3:44 am)
Re: Distributed storage., Evgeniy Polyakov, (Fri Aug 3, 3:57 am)
Re: Distributed storage., Peter Zijlstra, (Fri Aug 3, 5:27 am)
Re: Distributed storage., Evgeniy Polyakov, (Fri Aug 3, 6:49 am)
Re: Distributed storage., Peter Zijlstra, (Fri Aug 3, 7:53 am)
Re: Distributed storage., Daniel Phillips, (Fri Aug 3, 12:41 pm)
Re: Distributed storage., Daniel Phillips, (Fri Aug 3, 12:48 pm)
Re: Distributed storage., Daniel Phillips, (Fri Aug 3, 5:41 pm)
Re: Distributed storage., Daniel Phillips, (Fri Aug 3, 5:49 pm)
Re: Distributed storage., Daniel Phillips, (Fri Aug 3, 6:19 pm)
Re: Distributed storage., Dave Dillow, (Fri Aug 3, 7:51 pm)
Re: Distributed storage., Manu Abraham, (Fri Aug 3, 8:44 pm)
Re: Distributed storage., Evgeniy Polyakov, (Sat Aug 4, 9:37 am)
Re: Distributed storage., Evgeniy Polyakov, (Sat Aug 4, 9:44 am)
Re: Distributed storage., Evgeniy Polyakov, (Sat Aug 4, 10:03 am)
Re: Distributed storage., Daniel Phillips, (Sun Aug 5, 1:04 am)
Re: Distributed storage., Daniel Phillips, (Sun Aug 5, 1:06 am)
Re: Distributed storage., Evgeniy Polyakov, (Sun Aug 5, 8:01 am)
Re: Distributed storage., Evgeniy Polyakov, (Sun Aug 5, 8:08 am)
Re: Distributed storage., Daniel Phillips, (Sun Aug 5, 2:23 pm)
Re: Distributed storage., Daniel Phillips, (Sun Aug 5, 2:35 pm)
Re: Distributed storage., Evgeniy Polyakov, (Mon Aug 6, 1:25 am)
Re: Distributed storage., Evgeniy Polyakov, (Mon Aug 6, 1:28 am)
Re: Distributed storage., Jens Axboe, (Tue Aug 7, 5:05 am)
Re: Distributed storage., Daniel Phillips, (Tue Aug 7, 11:24 am)
Re: Distributed storage., Jens Axboe, (Tue Aug 7, 1:55 pm)
Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Wed Aug 8, 2:54 am)
[1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Wed Aug 8, 3:17 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Wed Aug 8, 6:28 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Daniel Phillips, (Sun Aug 12, 4:16 pm)
Re: Distributed storage., Daniel Phillips, (Sun Aug 12, 4:36 pm)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Sun Aug 12, 10:22 pm)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Sun Aug 12, 10:36 pm)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Sun Aug 12, 11:44 pm)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 12:28 am)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 12:45 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 1:14 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 1:18 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 1:23 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 1:59 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 2:08 am)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 2:12 am)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 2:13 am)
Re: Distributed storage., Evgeniy Polyakov, (Mon Aug 13, 2:18 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 2:55 am)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 3:06 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 3:12 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 3:15 am)
Re: Distributed storage., Jens Axboe, (Mon Aug 13, 3:22 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 3:32 am)
Re: Distributed storage., Evgeniy Polyakov, (Mon Aug 13, 4:03 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Mon Aug 13, 4:04 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Mon Aug 13, 4:18 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 4:45 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 5:04 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 5:18 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Mon Aug 13, 5:18 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Mon Aug 13, 5:24 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Mon Aug 13, 6:04 am)
Re: Distributed storage., Daniel Phillips, (Mon Aug 13, 4:27 pm)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 14, 1:46 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 14, 4:13 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 14, 4:30 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 14, 4:35 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 14, 4:50 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 14, 5:32 am)
Re: Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 14, 5:46 am)
Re: Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 14, 5:54 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Daniel Phillips, (Mon Aug 27, 2:57 pm)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 28, 2:35 am)
Re: Distributed storage., Evgeniy Polyakov, (Tue Aug 28, 10:19 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 28, 10:27 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Tue Aug 28, 10:54 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Daniel Phillips, (Tue Aug 28, 2:08 pm)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Wed Aug 29, 1:53 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Daniel Phillips, (Thu Aug 30, 4:20 pm)
Re: [1/1] Block device throttling [Re: Distributed storage.], Evgeniy Polyakov, (Fri Aug 31, 10:33 am)
Re: [1/1] Block device throttling [Re: Distributed storage.], Alasdair G Kergon, (Fri Aug 31, 2:41 pm)