From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTZnH-00033v-7y for qemu-devel@nongnu.org; Thu, 05 Mar 2015 12:42:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTZnD-0001IZ-8Q for qemu-devel@nongnu.org; Thu, 05 Mar 2015 12:42:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTZnC-0001Gr-Vt for qemu-devel@nongnu.org; Thu, 05 Mar 2015 12:42:39 -0500 Date: Thu, 5 Mar 2015 11:41:50 -0600 From: Stefan Hajnoczi Message-ID: <20150305174150.GB19499@stefanha-thinkpad.redhat.com> References: <142929b6b5adbf371309043d23864c22b0afdec4.1423842044.git.berto@igalia.com> <20150303210006.GG15846@stefanha-thinkpad.redhat.com> <20150304135341.GA11084@igalia.com> <20150304160427.GC15637@stefanha-thinkpad.redhat.com> <20150304161651.GA2872@igalia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="neYutvxvOLaeuPCA" Content-Disposition: inline In-Reply-To: <20150304161651.GA2872@igalia.com> Subject: Re: [Qemu-devel] [PATCH 7/9] throttle: Add throttle group support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org --neYutvxvOLaeuPCA Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 04, 2015 at 05:16:51PM +0100, Alberto Garcia wrote: > On Wed, Mar 04, 2015 at 10:04:27AM -0600, Stefan Hajnoczi wrote: >=20 > > > > This pattern suggests throttle_timer_fired() should acquire the > > > > lock internally instead. > > >=20 > > > The idea is that the ThrottleState code itself doesn't know > > > anything about locks or groups. As I understood it Beno=EEt > > > designed the ThrottleState code to be independent from the block > > > layer and reusable for other things (that's why it's in util/). > >=20 > > Then ThrottleGroup could offer an API throttle_group_timer_fired() > > that does the locking. > >=20 > > The advantage of encapsulating locking in ThrottleGroup is that > > callers don't have to remember the take the lock. (But they must > > still be careful about sequences of calls which will not be atomic.) >=20 > No other code in ThrottleGroup takes the lock directly, so making this > an exception could be confusing. It shouldn't be an exception. I'm proposing that the ThrottleGroup API should handle locking internally instead of requiring callers to do it. Stefan --neYutvxvOLaeuPCA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU+JVeAAoJEJykq7OBq3PIxBAIAL3YI+3pV3v4YjkYofP2rWdv ZKDxqZ6iVHKTl890wcL20Wm/zXSlmHKshW0uowj9OwvpHXmv33T21jqohYiQRZSO DGXdHCyEsWj3riHq0usE42Pmp1j4D9xV6B2yYIgh2XhtZTWffsQtsobVWPSv5Qml wODifrR7R7Tafi16wB3GE4Cr0skZx+PuztCxAjL1+KslgBGwBLEl9INskzhIEoOb 4PRqt//a7iHtTu4cQC/KUSofdRxT37c5dDyo7CJVOCdpsJ7j4CLvqVreASUOcDGt 8vSQbOpaanZqM2PFzQK7kQVIh1oHx39UN8VeIr7wC9XtWLDW14HfEwm3bLLfwo4= =wMLq -----END PGP SIGNATURE----- --neYutvxvOLaeuPCA--