From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1EF6B46970E for ; Tue, 14 Jan 2020 01:00:52 +0300 (MSK) References: <20200109200636.26308-1-skaplun@tarantool.org> From: Vladislav Shpilevoy Message-ID: <96b3011a-c4ce-d685-3b9e-4b2d2f497206@tarantool.org> Date: Mon, 13 Jan 2020 23:00:50 +0100 MIME-Version: 1.0 In-Reply-To: <20200109200636.26308-1-skaplun@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH] refactoring: drop excess 16Kb bss buffer List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Kaplun , tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! > diff --git a/src/lib/core/backtrace.cc b/src/lib/core/backtrace.cc > index 77f77b05c..eabd986df 100644 > --- a/src/lib/core/backtrace.cc > +++ b/src/lib/core/backtrace.cc > @@ -55,8 +56,6 @@ > > #define BACKTRACE_NAME_MAX 200 > > -static char backtrace_buf[4096 * 4]; > - > static __thread struct region cache_region; > static __thread struct mh_i64ptr_t *proc_cache = NULL; > > @@ -140,8 +139,9 @@ backtrace() > unw_getcontext(&unw_context); > unw_cursor_t unw_cur; > unw_init_local(&unw_cur, &unw_context); > + char *backtrace_buf = (char *)static_alloc(SMALL_STATIC_SIZE); Perhaps it is worth increasing SMALL_STATIC_SIZE with 4096 additional bytes so as not to decrease backtrace buffer size. Backtrace was using 4096 * 4, while SMALL_STATIC_SIZE is 4096 * 3. On the other hand, increase of static buffer size would make total size of BSS section even bigger than before the patch, because the static buffer is thread local. So + 4096 for this buffer means at least + 4096 * 3 because we have at least 3 threads. I am ok with both options. Because I don't know whether do we really need so big buffer for a backtrace or not. Also Cyrill is right, it is worth adding an assertion that static_alloc does not fail.