Received: from eggs.gnu.org ([2001:4830:134:3::10]:59015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFLS1-0005F5-Cp for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:57:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFLRv-0005TH-Di for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:57:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFLRv-0005T8-4H for qemu-devel@nongnu.org; Fri, 30 Aug 2013 05:57:03 -0400 Date: Fri, 30 Aug 2013 11:53:20 +0200 From: Stefan Hajnoczi Message-ID: <20130830095320.GB15010@stefanha-thinkpad.redhat.com> References: <1377702441-22236-1-git-send-email-benoit@irqsave.net> <20130829090945.GA31923@stefanha-thinkpad.redhat.com> <20130829093719.GC5142@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20130829093719.GC5142@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V7 0/5] Continuous Leaky Bucket Throttling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, Stefan Hajnoczi , qemu-devel@nongnu.org, pbonzini@redhat.com On Thu, Aug 29, 2013 at 11:37:20AM +0200, Beno=EEt Canet wrote: > > 1. We keep modifying the timer in bdrv_io_limits_intercept() on each > > request even when it has already been set. I think we'll set it t= o > > the same absolute timestamp, modulo numerical issues. Should we > > avoid doing this? >=20 > I could check that the timer is not pending before setting it. Paolo is making timer_pending() very cheap so this sounds good. > >=20 > > 2. bdrv_io_limits_resched() only wakes up requests of the same type > > (read/write). Does this mean that BPS_TOTAL/IOPS_TOTAL requests > > will have to wait until the other request type timer expires inste= ad > > of piggybacking on request completion? > >=20 > > Is this a problem? If no, then why piggyback on request completio= n > > at all since apparently it works fine when we don't wake up the ot= her > > request type? >=20 > It only wakes up the same request type to be coherent with the two requ= ests > queues and two timers strategy. > The ultimate goal of this is to be able to do: > block_set_io_throttle virtio1 0 0 0 0 3000 1 > The code can cope with this and do independent throttling for reads and > writes. I understand why there are separate queues for r/w requests. What I'm getting at is that bdrv_io_limits_resched() in its current form is not needed: Resources are refilled as time passes, not by completing requests, so there should be no need to act when a request completes. bdrv_io_limits_resched() is not necessary (if it was, BPS_TOTAL/IOPS_TOTAL wouldn't work since bdrv_io_limits_resched() does not handle the other request type). bdrv_io_limits_intercept() should wake the next request after calling throttle_account() so we can submit as many requests as possible right away, instead of waiting for the first request to complete before submitting the next request. After this change: 1. Submitting a request also kicks queued requests. We always submit as many requests as allowed by the bucket. 2. If we need to wait the timer will wake us up when more resources are available. Stefan