From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Kirill Shcherbatov <kshcherbatov@tarantool.org> Cc: Konstantin Osipov <kostja@tarantool.org>, tarantool-patches@freelists.org Subject: Re: [tarantool-patches] [PATCH v3 1/7] memtx: introduce universal iterator_pool Date: Mon, 25 Feb 2019 19:14:12 +0300 [thread overview] Message-ID: <20190225161412.nezlk5fmgqogltdf@esperanza> (raw) In-Reply-To: <03d25801-f541-33ab-0cc2-d8f50a24e390@tarantool.org> On Sat, Feb 23, 2019 at 03:03:02PM +0300, Kirill Shcherbatov wrote: > diff --git a/src/box/memtx_bitset.c b/src/box/memtx_bitset.c > index cd7362ee1..9dbc4141d 100644 > --- a/src/box/memtx_bitset.c > +++ b/src/box/memtx_bitset.c > @@ -162,6 +162,10 @@ struct bitset_index_iterator { > struct mempool *pool; > }; > > +static_assert(sizeof(struct bitset_index_iterator) <= MEMTX_ITERATOR_SIZE, > + "bitset_index_iterator must be less or equal than " "sizeof(struct bitset_index_iterator) must be less than or equal to MEMTX_ITERATOR_SIZE" Ditto for other static assertions. > + "MEMTX_ITERATOR_SIZE"); > + > static struct bitset_index_iterator * > bitset_index_iterator(struct iterator *it) > { > @@ -493,9 +497,9 @@ memtx_bitset_index_new(struct memtx_engine *memtx, struct index_def *def) > assert(def->iid > 0); > assert(!def->opts.is_unique); > > - if (!mempool_is_initialized(&memtx->bitset_iterator_pool)) { > - mempool_create(&memtx->bitset_iterator_pool, cord_slab_cache(), > - sizeof(struct bitset_index_iterator)); > + if (!mempool_is_initialized(&memtx->iterator_pool)) { > + mempool_create(&memtx->iterator_pool, cord_slab_cache(), > + MEMTX_ITERATOR_SIZE); Since there's one pool for bitset, hash, and tree indexes, size of which is known in advance, we can initialize it in the engine constructor and destroy it unconditionally in the engine destructor. > diff --git a/src/box/memtx_engine.h b/src/box/memtx_engine.h > index 0f8e92ee4..5859390d8 100644 > --- a/src/box/memtx_engine.h > +++ b/src/box/memtx_engine.h > @@ -87,6 +87,14 @@ enum memtx_recovery_state { > /** Memtx extents pool, available to statistics. */ > extern struct mempool memtx_index_extent_pool; > > +/** > + * The size of the biggest memtx iterator. Used with > + * mempool_create. This is the size of the block that will be > + * allocated for each iterator (except rtree index iterator that > + * is significantly bigger so has own pool). > + */ > +#define MEMTX_ITERATOR_SIZE (696) Should be about 150 bytes without rtree, no? > + > struct memtx_engine { > struct engine base; > /** Engine recovery state. */ > @@ -129,14 +137,10 @@ struct memtx_engine { > size_t max_tuple_size; > /** Incremented with each next snapshot. */ > uint32_t snapshot_version; > - /** Memory pool for tree index iterator. */ > - struct mempool tree_iterator_pool; > /** Memory pool for rtree index iterator. */ > struct mempool rtree_iterator_pool; > - /** Memory pool for hash index iterator. */ > - struct mempool hash_iterator_pool; > - /** Memory pool for bitset index iterator. */ > - struct mempool bitset_iterator_pool; > + /** Memory pool for index iterator. */ Memory pool for all index iterators except rtree. The latter is significantly larger so it has its own memory pool. > + struct mempool iterator_pool;
next prev parent reply other threads:[~2019-02-25 16:14 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-22 15:42 [PATCH v3 0/7] box: introduce hint option for memtx tree index Kirill Shcherbatov 2019-02-22 15:42 ` [PATCH v3 1/7] memtx: introduce universal iterator_pool Kirill Shcherbatov 2019-02-22 18:37 ` [tarantool-patches] " Konstantin Osipov 2019-02-23 12:03 ` Kirill Shcherbatov 2019-02-25 16:14 ` Vladimir Davydov [this message] 2019-02-25 16:39 ` [tarantool-patches] " Kirill Shcherbatov 2019-02-25 17:14 ` Vladimir Davydov 2019-02-24 6:56 ` [tarantool-patches] " Vladimir Davydov 2019-02-24 17:15 ` Konstantin Osipov 2019-02-24 18:22 ` Vladimir Davydov 2019-02-25 16:46 ` [tarantool-patches] " Konstantin Osipov 2019-02-25 17:15 ` Vladimir Davydov 2019-02-22 15:42 ` [PATCH v3 2/7] lib: fix undef _api_name in bps_tree header Kirill Shcherbatov 2019-02-22 18:37 ` [tarantool-patches] " Konstantin Osipov 2019-02-25 15:32 ` Vladimir Davydov 2019-02-22 15:42 ` [PATCH v3 3/7] lib: introduce BPS_TREE_IDENTICAL custom comparator Kirill Shcherbatov 2019-02-25 15:33 ` Vladimir Davydov 2019-02-22 15:42 ` [PATCH v3 4/7] memtx: hide index implementation details from header Kirill Shcherbatov 2019-02-22 18:40 ` [tarantool-patches] " Konstantin Osipov 2019-02-25 15:33 ` Vladimir Davydov 2019-02-22 15:42 ` [PATCH v3 5/7] memtx: rework memtx_tree to store arbitrary nodes Kirill Shcherbatov 2019-02-25 16:57 ` Vladimir Davydov 2019-02-26 12:10 ` [tarantool-patches] " Kirill Shcherbatov 2019-02-22 15:42 ` [PATCH v3 6/7] memtx: rename memtx_tree.c to memtx_tree_impl.h Kirill Shcherbatov 2019-02-22 15:42 ` [PATCH v3 7/7] memtx: introduce tuple compare hint Kirill Shcherbatov 2019-02-25 17:44 ` Vladimir Davydov 2019-02-26 12:10 ` [tarantool-patches] " Kirill Shcherbatov
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=20190225161412.nezlk5fmgqogltdf@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH v3 1/7] memtx: introduce universal iterator_pool' \ /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