[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V5 3/5] block: Enable the new throttling code in
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V5 3/5] block: Enable the new throttling code in the block layer. |
Date: |
Fri, 16 Aug 2013 14:02:24 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Aug 12, 2013 at 06:53:14PM +0200, Benoît Canet wrote:
> +/* this function drain all the throttled IOs */
> +static bool bdrv_drain_throttled(BlockDriverState *bs)
> +{
> + bool drained = false;
> + bool enabled = bs->io_limits_enabled;
> + int i;
>
> - do {} while (qemu_co_enter_next(&bs->throttled_reqs));
> + bs->io_limits_enabled = false;
>
> - if (bs->block_timer) {
> - qemu_del_timer(bs->block_timer);
> - qemu_free_timer(bs->block_timer);
> - bs->block_timer = NULL;
> + for (i = 0; i < 2; i++) {
> + while (qemu_co_enter_next(&bs->throttled_reqs[i])) {
> + drained = true;
> + }
> }
This function submits throttled requests but it doesn't drain them -
they might still be executing when this function returns!
> +/* should be called before bdrv_set_io_limits if a limit is set */
> void bdrv_io_limits_enable(BlockDriverState *bs)
> {
> - qemu_co_queue_init(&bs->throttled_reqs);
> - bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs);
Make sure we never double-initialized ->throttle_state:
assert(!bs->io_limits enabled);
> @@ -2512,11 +2552,6 @@ static int coroutine_fn
> bdrv_co_do_readv(BlockDriverState *bs,
> return -EIO;
> }
>
> - /* throttling disk read I/O */
> - if (bs->io_limits_enabled) {
> - bdrv_io_limits_intercept(bs, false, nb_sectors);
> - }
> -
Why move bdrv_io_limits_intercept() into tracked_request_begin()? IMO
tracked_request_begin() should only create the tracked request, it
shouldn't do unrelated stuff like I/O throttling and yielding. If it
does then it must be declared coroutine_fn.
- [Qemu-devel] [PATCH V5 0/5] Continuous Leaky Bucket Throttling, Benoît Canet, 2013/08/12
- [Qemu-devel] [PATCH V5 1/5] throttle: Add a new t hrottling API implementing continuous leaky bucket., Benoît Canet, 2013/08/12
- [Qemu-devel] [PATCH V5 2/5] throttle: Add units t ests, Benoît Canet, 2013/08/12
- [Qemu-devel] [PATCH V5 3/5] block: Enable the new throttling code in the block layer., Benoît Canet, 2013/08/12
- [Qemu-devel] [PATCH V5 4/5] block: Add support fo r throttling burst max in QMP and the command line., Benoît Canet, 2013/08/12
- [Qemu-devel] [PATCH V5 5/5] block: Add iops_sec tor_count to do the iops accounting for a given io siz e., Benoît Canet, 2013/08/12
- Re: [Qemu-devel] [PATCH V5 0/5] Continuous Leaky Bucket Throttling, Stefan Hajnoczi, 2013/08/16