[PATCH v2 2/2] memtx: run garbage collection on demand

Vladimir Davydov vdavydov.dev at gmail.com
Thu May 24 09:15:20 MSK 2018


On Wed, May 23, 2018 at 08:58:46PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at gmail.com> [18/05/22 20:29]:
> > -	void *ret = mempool_alloc(&memtx->index_extent_pool);
> > +	void *ret;
> > +	while ((ret = mempool_alloc(&memtx->index_extent_pool)) == NULL) {
> > +		bool stop;
> > +		memtx_engine_run_gc(memtx, &stop);
> > +		if (stop)
> > +			break;
> > +	}
> >  	if (ret == NULL)
> >  		diag_set(OutOfMemory, MEMTX_EXTENT_SIZE,
> >  			 "mempool", "new slab");
> > @@ -1184,6 +1196,10 @@ memtx_index_extent_reserve(struct memtx_engine *memtx, int num)
> >  	while (memtx->num_reserved_extents < num) {
> >  		void *ext = mempool_alloc(&memtx->index_extent_pool);
> >  		if (ext == NULL) {
> > +			bool stop;
> > +			memtx_engine_run_gc(memtx, &stop);
> > +			if (!stop)
> > +				continue;
> >  			diag_set(OutOfMemory, MEMTX_EXTENT_SIZE,
> >  				 "mempool", "new slab");
> >  			return -1;
> 
> I would rewrite this loop in the same idiomatic style as the
> previous one to avoid if (!stop) check.

OK, will do before pushing it.

> 
> OK to push.



More information about the Tarantool-patches mailing list