Received: from eggs.gnu.org ([2001:4830:134:3::10]:59052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbkhH-0008Tb-3d for qemu-devel@nongnu.org; Wed, 08 Oct 2014 02:26:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbkhB-0006I0-Uz for qemu-devel@nongnu.org; Wed, 08 Oct 2014 02:26:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbkhB-0006HM-Ok for qemu-devel@nongnu.org; Wed, 08 Oct 2014 02:25:57 -0400 Date: Wed, 8 Oct 2014 14:26:02 +0800 From: Fam Zheng Message-ID: <20141008062602.GC15829@fam-t430.nay.redhat.com> References: <1412688279-8312-1-git-send-email-benoit.canet@nodalink.com> <1412688279-8312-7-git-send-email-benoit.canet@nodalink.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1412688279-8312-7-git-send-email-benoit.canet@nodalink.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v1 6/8] throttle: Add a way to fire one of the timers asap like a bottom half List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Tue, 10/07 15:24, Beno=EEt Canet wrote: > This will be needed by the group throttling algorithm. >=20 > Signed-off-by: Benoit Canet > --- > include/qemu/throttle.h | 2 ++ > util/throttle.c | 11 +++++++++++ > 2 files changed, 13 insertions(+) >=20 > diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h > index 3a16c48..3b9d1b8 100644 > --- a/include/qemu/throttle.h > +++ b/include/qemu/throttle.h > @@ -127,6 +127,8 @@ bool throttle_schedule_timer(ThrottleState *ts, > bool is_write, > bool *armed); > =20 > +void throttle_fire_timer(ThrottleTimers *tt, bool is_write); > + > void throttle_timer_fired(ThrottleState *ts, bool is_write); > =20 > void throttle_account(ThrottleState *ts, bool is_write, uint64_t size)= ; > diff --git a/util/throttle.c b/util/throttle.c > index a273acb..163b9d0 100644 > --- a/util/throttle.c > +++ b/util/throttle.c > @@ -403,6 +403,17 @@ bool throttle_schedule_timer(ThrottleState *ts, > return true; > } > =20 > +/* Schedule a throttle timer like a BH Why not use a real BH? It's more efficient than a timer scheduled at now = + 1. Fam > + * > + * @tt: The timers structure > + * @is_write: the type of operation (read/write) > + */ > +void throttle_fire_timer(ThrottleTimers *tt, bool is_write) > +{ > + int64_t now =3D qemu_clock_get_ns(tt->clock_type); > + timer_mod(tt->timers[is_write], now + 1); > +} > + > /* Remember that now timers are currently armed > * > * @ts: the throttle state we are working on > --=20 > 2.1.1 >=20