From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (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 8578F4765E3 for ; Sun, 27 Dec 2020 20:44:57 +0300 (MSK) Date: Sun, 27 Dec 2020 20:44:09 +0300 From: Sergey Kaplun Message-ID: <20201227174409.GD14702@root> References: <47fe3e90153279081caedd4799a0e0dffdfac7be.1608907726.git.skaplun@tarantool.org> <20201227130916.GJ5396@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201227130916.GJ5396@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH luajit v2 4/7] core: introduce new mem_L field List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Igor, Thanks for the review! On 27.12.20, Igor Munkin wrote: > Sergey, > > Thanks for the patch! I guess this commit can be squashed with the > following (introducing memprof engine), since field is added > only to make it work. Also consider my comments below. > > On 25.12.20, Sergey Kaplun wrote: > > To determine currently allocating coroutine (that may not be equal to > > currently executed one) a new field called mem_L is added to > > global_State structure. This field is set on each allocation event and > > stores the coroutine address that is used for allocation. > > > > Part of tarantool/tarantool#5442 > > --- > > src/lj_gc.c | 2 ++ > > src/lj_obj.h | 1 + > > 2 files changed, 3 insertions(+) > > > > diff --git a/src/lj_gc.c b/src/lj_gc.c > > index 44c8aa1..800fb2c 100644 > > --- a/src/lj_gc.c > > +++ b/src/lj_gc.c > > @@ -852,6 +852,8 @@ void *lj_mem_realloc(lua_State *L, void *p, GCSize osz, GCSize nsz) > > { > > global_State *g = G(L); > > lua_assert((osz == 0) == (p == NULL)); > > + > > + setgcref(g->mem_L, obj2gco(L)); > > This field is initialized only here. What about and > ? As for the latter the initialization is not necessary, > since all deallocations are reported as internals (but the comment > strongly required), but this assignment is definitely lost in the first > routine. I'll squash this patch with the next as you recommended and send v3 for that patch (5/7) in the reply to the cover. > > > p = g->allocf(g->allocd, p, osz, nsz); > > if (p == NULL && nsz > 0) > > lj_err_mem(L); > > > > > -- > > 2.28.0 > > > > -- > Best regards, > IM -- Best regards, Sergey Kaplun