From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBNdc-0002ZX-Ee for qemu-devel@nongnu.org; Mon, 19 Aug 2013 07:28:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBNdW-0005G7-62 for qemu-devel@nongnu.org; Mon, 19 Aug 2013 07:28:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBNdV-0005EO-PR for qemu-devel@nongnu.org; Mon, 19 Aug 2013 07:28:37 -0400 Message-ID: <52120136.4070401@redhat.com> Date: Mon, 19 Aug 2013 13:27:50 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1376326396-7676-1-git-send-email-benoit@irqsave.net> <1376326396-7676-2-git-send-email-benoit@irqsave.net> <20130816114505.GA22193@stefanha-thinkpad.redhat.com> In-Reply-To: <20130816114505.GA22193@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V5 1/5] throttle: Add a new throttling API implementing continuous leaky bucket. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, =?ISO-8859-1?Q?Beno=EEt_Canet?= , stefanha@redhat.com, qemu-devel@nongnu.org Il 16/08/2013 13:45, Stefan Hajnoczi ha scritto: >> > +#define BUCKETS_COUNT 6 >> > + >> > +typedef enum { >> > + THROTTLE_BPS_TOTAL = 0, >> > + THROTTLE_BPS_READ = 1, >> > + THROTTLE_BPS_WRITE = 2, >> > + THROTTLE_OPS_TOTAL = 3, >> > + THROTTLE_OPS_READ = 4, >> > + THROTTLE_OPS_WRITE = 5, >> > +} BucketType; Please remove the "= N" from the enums, and add BUCKETS_COUNT here. >> > +typedef struct LeakyBucket { >> > + double ups; /* units per second */ >> > + double max; /* leaky bucket max in units */ >> > + double bucket; /* bucket in units */ > These comments aren't very clear to me :). So I guess bps or iops would > be in ups. Max would be the total budget or maximum burst. Bucket > might be the current level. I also suggest replacing "ups" with "avg", since it's the average throughput that the leaky bucket allows after the initial burst has emptied the bucket. >> + uint64_t unit_size; /* size of an unit in bytes */ >> + uint64_t op_size; /* size of an operation in units */ > > It's not clear yet why we need both unit_size *and* op_size. I thought > you would have a single granularity field for accounting big requests as > multiple iops. IIUC the ops buckets account operations in op_size / unit_size units, while the bps buckets account operations in 1 / unit_size units, or something like that. But it needs clarification indeed. Paolo