Received: from eggs.gnu.org ([2001:4830:134:3::10]:44878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLT4o-0000Ce-TB for qemu-devel@nongnu.org; Wed, 11 Feb 2015 03:55:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLT4l-0002ZV-Ek for qemu-devel@nongnu.org; Wed, 11 Feb 2015 03:55:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLT4l-0002ZM-6w for qemu-devel@nongnu.org; Wed, 11 Feb 2015 03:55:15 -0500 From: Juan Quintela In-Reply-To: <1423623986-590-3-git-send-email-liang.z.li@intel.com> (Liang Li's message of "Wed, 11 Feb 2015 11:06:16 +0800") References: <1423623986-590-1-git-send-email-liang.z.li@intel.com> <1423623986-590-3-git-send-email-liang.z.li@intel.com> Date: Wed, 11 Feb 2015 09:55:10 +0100 Message-ID: <87r3twddzl.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [v5 02/12] migration: Add the framework of multi-thread compression Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liang Li Cc: armbru@redhat.com, qemu-devel@nongnu.org, Yang Zhang , amit.shah@redhat.com, lcapitulino@redhat.com, dgilbert@redhat.com Liang Li wrote: > Add the code to create and destroy the multiple threads those will > be used to do data compression. Left some functions empty to keep > clearness, and the code will be added later. > > Signed-off-by: Liang Li > Signed-off-by: Yang Zhang > Reviewed-by: Dr.David Alan Gilbert /me goes back > +struct CompressParam { > + /* To be done */ > +}; > +typedef struct CompressParam CompressParam; > + > +static CompressParam *comp_param; > +static bool quit_comp_thread; > + > +static void *do_data_compress(void *opaque) > +{ > + while (!quit_comp_thread) { Using this variable without any protection, read from all threads. > + > + /* To be done */ > + > + } > + > + return NULL; > +} > + > +static inline void terminate_compression_threads(void) > +{ > + quit_comp_thread = true; written from the main migration thread. Shouldn't we use a mutex or at least atomic accessors? PD. I haven't yet finishing reading the series, in case this is fixed later.