From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Konstantin Osipov <kostja@tarantool.org> Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 1/2] swim: pool IO tasks Date: Sat, 6 Jul 2019 23:00:28 +0200 [thread overview] Message-ID: <609c7e7b-d8f7-413b-752c-94034bfd689b@tarantool.org> (raw) In-Reply-To: <20190705230136.GD30966@atlas> On 06/07/2019 01:01, Konstantin Osipov wrote: > * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/07/06 01:39]: >> + >> +/** >> + * All the SWIM instances and their members use the same objects >> + * to send data - tasks. Each task is ~1.5KB, and on one hand it >> + * would be a waste of memory to keep preallocated tasks for each >> + * member. One the other hand it would be too slow to allocate >> + * and delete ~1.5KB on each interaction, ~3KB on each round step. >> + * Here is a pool of free tasks shared among all SWIM instances >> + * to avoid allocations, but do not keep a separate task for each >> + * member. >> + */ >> +static struct stailq swim_task_pool; >> +/** Number of pooled tasks. */ >> +static int swim_task_pool_size = 0; > > These should be thread-local. Why? SWIM works in one thread, these values are never accessed from another one. They would be just copied for each thread and unused in all but one. > > Why not use mempool? > > Because 1) it is an overkill, 2) I don't want to depend on slab allocator, 3) it just does not fit this case, according to mempool description from mempool.h: "Good for allocating tons of small objects of the same size.".
next prev parent reply other threads:[~2019-07-06 20:59 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-05 22:40 [tarantool-patches] [PATCH 0/2] SWIM micro optimizations Vladislav Shpilevoy 2019-07-05 22:40 ` [tarantool-patches] [PATCH 1/2] swim: pool IO tasks Vladislav Shpilevoy 2019-07-05 23:01 ` [tarantool-patches] " Konstantin Osipov 2019-07-06 21:00 ` Vladislav Shpilevoy [this message] 2019-07-08 8:25 ` Konstantin Osipov 2019-07-08 18:31 ` Vladislav Shpilevoy 2019-07-08 21:54 ` Konstantin Osipov 2019-07-08 22:13 ` Vladislav Shpilevoy 2019-07-08 23:08 ` Konstantin Osipov 2019-07-09 19:43 ` Vladislav Shpilevoy 2019-07-09 22:24 ` Konstantin Osipov 2019-07-05 22:40 ` [tarantool-patches] [PATCH 2/2] swim: optimize struct swim_task layout Vladislav Shpilevoy 2019-07-05 23:02 ` [tarantool-patches] " Konstantin Osipov
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=609c7e7b-d8f7-413b-752c-94034bfd689b@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 1/2] swim: pool IO tasks' \ /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