Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-27 Thread Peter Xu
On Thu, Mar 22, 2018 at 07:57:54PM +0800, Xiao Guangrong wrote: > > > On 03/21/2018 05:06 PM, Peter Xu wrote: > > On Tue, Mar 13, 2018 at 03:57:33PM +0800, guangrong.x...@gmail.com wrote: > > > From: Xiao Guangrong > > > > > > Current code uses

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-22 Thread Xiao Guangrong
On 03/21/2018 05:06 PM, Peter Xu wrote: On Tue, Mar 13, 2018 at 03:57:33PM +0800, guangrong.x...@gmail.com wrote: From: Xiao Guangrong Current code uses compress2()/uncompress() to compress/decompress memory, these two function manager memory allocation and

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-21 Thread Peter Xu
On Tue, Mar 13, 2018 at 03:57:33PM +0800, guangrong.x...@gmail.com wrote: > From: Xiao Guangrong > > Current code uses compress2()/uncompress() to compress/decompress > memory, these two function manager memory allocation and release > internally, that causes huge

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-19 Thread Xiao Guangrong
On 03/19/2018 06:54 PM, Dr. David Alan Gilbert wrote: +return 0; +exit: +compress_threads_load_cleanup(); I don't think this is safe; if inflateInit(..) fails in not-the-last thread, compress_threads_load_cleanup() will try and destroy all the mutex's and condition variables, even

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-19 Thread Dr. David Alan Gilbert
* Xiao Guangrong (guangrong.x...@gmail.com) wrote: > > > On 03/15/2018 07:03 PM, Dr. David Alan Gilbert wrote: > > > > +static int compress_threads_load_setup(void) > > > +{ > > > +int i, thread_count; > > > + > > > +if (!migrate_use_compression()) { > > > +return 0; > > > +

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-16 Thread Xiao Guangrong
On 03/15/2018 07:03 PM, Dr. David Alan Gilbert wrote: +static int compress_threads_load_setup(void) +{ +int i, thread_count; + +if (!migrate_use_compression()) { +return 0; +} + +thread_count = migrate_decompress_threads(); +decompress_threads = g_new0(QemuThread,

Re: [Qemu-devel] [PATCH 2/8] migration: stop allocating and freeing memory frequently

2018-03-15 Thread Dr. David Alan Gilbert
* guangrong.x...@gmail.com (guangrong.x...@gmail.com) wrote: > From: Xiao Guangrong > > Current code uses compress2()/uncompress() to compress/decompress > memory, these two function manager memory allocation and release > internally, that causes huge memory is