From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] fiber: extend max fiber name length to 255
Date: Sat, 14 Mar 2020 18:25:48 +0100 [thread overview]
Message-ID: <5b4578df-aab3-968b-f9bd-a00b60bd6591@tarantool.org> (raw)
In-Reply-To: <20200314163432.GW27301@uranus>
On 14/03/2020 17:34, Cyrill Gorcunov wrote:
> On Sat, Mar 14, 2020 at 04:16:35PM +0100, Vladislav Shpilevoy wrote:
>> Users keep complaining about too short fiber name. New limit is
>> 255, should be enough for any sane name.
>>
>> Closes #4394
>>
>> fiber_set_name(struct fiber *fiber, const char *name)
>> {
>> - assert(name != NULL);
>> - snprintf(fiber->name, sizeof(fiber->name), "%s", name);
>> + size_t len = MIN(strlen(name), FIBER_NAME_MAX);
>> + char *new_name = realloc(fiber->name, len + 1);
>
> I don't like it completely. The fiber cache has been made
> not just to eliminate new memory allocation but also to
> reduce memory fragmentation and now we give a user a hand
> to shuffle memory in easy path :(
Heap fragmentation does not affect anything. We allocate data
not on the heap, but on slab arena. Heap is used for metadata
such as space_defs, index_defs, key_defs. Moreover, heap is
used for everything used by Lua. I don't see any problem with
allocating non-data objects on the heap.
Talking of fiber cache - I think *this* may be a bad thing.
Because fibers are never deleted. So from a certain point of
time the mempool does not do speed up any alloc/free calls. And
just occupies slabs that could be used for data, and increases
the arena fragmentation.
> If 32 bytes is really not enough lest make it 64 (or 128)
If we make it 64 are more, we just aggravate the problem I
described above.
> and allocate together with fiber cache.
>
>> + if (new_name == NULL)
>> + panic("fiber_set_name() can't fail");
>> + fiber->name = new_name;
>> + memcpy(new_name, name, len);
>> + new_name[len] = 0;
next prev parent reply other threads:[~2020-03-14 17:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-14 15:16 Vladislav Shpilevoy
2020-03-14 16:34 ` Cyrill Gorcunov
2020-03-14 17:25 ` Vladislav Shpilevoy [this message]
2020-03-14 17:32 ` Vladislav Shpilevoy
2020-03-14 19:48 ` Cyrill Gorcunov
2020-03-15 15:13 ` Vladislav Shpilevoy
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=5b4578df-aab3-968b-f9bd-a00b60bd6591@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 1/1] fiber: extend max fiber name length to 255' \
/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