Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v2 2/2] memtx: run garbage collection on demand
Date: Thu, 24 May 2018 09:15:20 +0300	[thread overview]
Message-ID: <20180524061520.svdeb7o72tvw663m@esperanza> (raw)
In-Reply-To: <20180523175846.GE4266@atlas>

On Wed, May 23, 2018 at 08:58:46PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@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.

      reply	other threads:[~2018-05-24  6:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 17:25 [PATCH v2 0/2] Follow-up on async memtx index cleanup Vladimir Davydov
2018-05-22 17:25 ` [PATCH v2 1/2] memtx: rework background garbage collection procedure Vladimir Davydov
2018-05-23 17:56   ` Konstantin Osipov
2018-05-24  6:13     ` Vladimir Davydov
2018-05-22 17:25 ` [PATCH v2 2/2] memtx: run garbage collection on demand Vladimir Davydov
2018-05-23 17:58   ` Konstantin Osipov
2018-05-24  6:15     ` Vladimir Davydov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180524061520.svdeb7o72tvw663m@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 2/2] memtx: run garbage collection on demand' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox