From: "Benoît Canet" <benoit.canet@nodalink.com>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org,
"Benoît Canet" <benoit.canet@nodalink.com>
Subject: Re: [Qemu-devel] [PATCH v1 7/8] throttle: Add throttle group support
Date: Fri, 10 Oct 2014 11:35:10 +0000 [thread overview]
Message-ID: <20141010113510.GC22893@nodalink.com> (raw)
In-Reply-To: <20141009085822.GA4692@fam-t430.nay.redhat.com>
On Thu, Oct 09, 2014 at 04:58:22PM +0800, Fam Zheng wrote:
> On Wed, 10/08 11:05, Benoît Canet wrote:
> > On Wed, Oct 08, 2014 at 02:53:38PM +0800, Fam Zheng wrote:
> > >
> > > Does this mean that after this series, all the throttle_states must be
> > > contained inside its own throttle group? If so, we could embed ThrottleGroup
> > > fields in ThrottleState.
> > >
> > > It's weird when a function called throttle_group_compare takes a parameter of
> > > ThrottleState pointer, and cast it back to ThrottleGroup with container_of.
> >
> > It's done like this to fullfill a design goal: the throttle should be reusable
> > without the groups and any reference to block related stuff.
> > So it's just a way to split the responsabilities.
>
> I see.
>
> Having both ThrottleGroup and ThrottleState interfaces is more complicated than
> just use ThrottleGroup, where a one-member group is exactly the same as
> ThrottleState.
Here my interest conflict between a short term strategy (comply and getting these
patches merged asap) and the technical advantage of keeping ThrottleState and
ThrottleGroup separated.
orthogonality
-------------
An advantage to keep ThrottleState and ThrottleGroup separated is that
the two roles of implementing the throttle itself and implementing the behavior
of a group are keep separated.
As a result each piece of code is simpler to write, review and test.
genericity
----------
When writing the initial throttle code I carefully designed it to be independant
of BlockDriverState.
As a result the throttle code lives in util/ and is easilly reusable into whatever
we want (a device model or network throttling).
It is mean, designed and written to be as generic as possible.
So yes merging ThrottleState and ThrottleGroup would result in the seemlingly nice
thing that one structure is simpler than two structure.
But it would also imply the fact that I really hate that this pesky
BlockDriverState structure would become tied to ThrottleState.
If we do this ThrottleState would move out of util/ to block/ and we would
have lost the ability to reuse this infrastructure. It would be a short term gain
and a long term loss.
Another fact is that the rationale "1 structure is simpler than 2" is not alway
relevant: look for BlockBackend that we are desesperately trying to move out of
BlockDriverState.
Best regards
Benoît
>
> Fam
next prev parent reply other threads:[~2014-10-10 11:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 13:24 [Qemu-devel] [PATCH v1 0/8] Block Throttle Group Support Benoît Canet
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 1/8] throttle: Extract timers from ThrottleState into a separate ThrottleTimers structure Benoît Canet
2014-10-08 5:51 ` Fam Zheng
2014-10-08 15:06 ` Eric Blake
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 2/8] throttle: Add throttle group infrastructure Benoît Canet
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 3/8] throttle: Add throttle group infrastructure tests Benoît Canet
2014-10-08 6:20 ` Fam Zheng
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 4/8] throttle: Prepare to have multiple timers for one ThrottleState Benoît Canet
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 5/8] throttle: Add a way to know if throttle_schedule_timer had armed a timer Benoît Canet
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 6/8] throttle: Add a way to fire one of the timers asap like a bottom half Benoît Canet
2014-10-08 6:26 ` Fam Zheng
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 7/8] throttle: Add throttle group support Benoît Canet
2014-10-08 6:53 ` Fam Zheng
2014-10-08 11:05 ` Benoît Canet
2014-10-09 8:58 ` Fam Zheng
2014-10-10 11:35 ` Benoît Canet [this message]
2014-10-07 13:24 ` [Qemu-devel] [PATCH v1 8/8] throttle: Update throttle infrastructure copyright Benoît Canet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141010113510.GC22893@nodalink.com \
--to=benoit.canet@nodalink.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).