Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Mikhail Shishatskiy <m.shishatskiy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v2 1/2] memprof: dump traceno if allocate from trace
Date: Sat, 14 Aug 2021 11:00:51 +0300	[thread overview]
Message-ID: <YRd4M1l/st30pPNS@root> (raw)
In-Reply-To: <20210728134259.1113235-2-m.shishatskiy@tarantool.org>

Hi!

Thanks for the fixes!

LGTM, except a few nits regarding the commit message and comment in
the code.

On 28.07.21, Mikhail Shishatskiy wrote:
> When LuaJIT executes a trace, the trace number is stored in
> the virtual machine state. So, we can treat this number as
> an allocation event source in memprof and report allocation events
> from traces as well.
> 
> Previously, all the allocations from traces were marked as INTERNAL.
> 
> This patch introduces the functionality described above by adding
> a new allocation source type named ASOURCE_TRACE. If at the moment
> when allocation event occurs VM state indicates that trace executed,
> trace number streamed to a binary file:
> 
> | loc-trace := trace-no
> | trace-no  := <ULEB128>
> 
> Also, the memory profiler parser was adjusted to recognize this

Typo: s/was/is/

> source type by extending <loc> structure: field <traceno>,
> representing trace number, was added.

Typo: s/trace number/a trace number/
Typo: s/was/is/

> 
> Part of tarantool/tarantool#5814
> ---
> 
> Issue: https://github.com/tarantool/tarantool/issues/5814
> Branch: https://github.com/tarantool/luajit/tree/shishqa/gh-5814-group-allocations-on-trace-by-trace-number
> CI: https://github.com/tarantool/tarantool/tree/shishqa/gh-5814-group-allocations-on-trace-by-trace-number
> 
>  src/lj_memprof.c        | 14 ++++++++++++--
>  src/lj_memprof.h        | 13 ++++++++-----
>  tools/memprof/parse.lua | 22 ++++++++++++++--------
>  3 files changed, 34 insertions(+), 15 deletions(-)
> 
> diff --git a/src/lj_memprof.c b/src/lj_memprof.c
> index 2c1ef3b8..0c7e9e89 100644
> --- a/src/lj_memprof.c
> +++ b/src/lj_memprof.c

<snipped>

> @@ -168,9 +176,11 @@ static const memprof_writer memprof_writers[] = {
>    ** But since traces must follow the semantics of the original code,
>    ** behaviour of Lua and JITted code must match 1:1 in terms of allocations,
>    ** which makes using memprof with enabled JIT virtually redundant.
> -  ** Hence use the stub below.
> +  ** But if one wants to investigate allocations with JIT enabled,
> +  ** memprof_write_trace() dumps trace number to the binary output. 

Typo: trailing whitespace here ---------------------------------------^

> +  ** It can be useful to compare with with jit.v or jit.dump outputs.
>    */
> -  memprof_write_hvmstate /* LJ_VMST_TRACE */
> +  memprof_write_trace /* LJ_VMST_TRACE */
>  };
>  
>  static void memprof_write_caller(struct memprof *mp, uint8_t aevent)
> diff --git a/src/lj_memprof.h b/src/lj_memprof.h
> index 3417475d..e3f55433 100644
> --- a/src/lj_memprof.h
> +++ b/src/lj_memprof.h

<snipped>

> diff --git a/tools/memprof/parse.lua b/tools/memprof/parse.lua
> index 12e2758f..2d3c71f0 100644
> --- a/tools/memprof/parse.lua
> +++ b/tools/memprof/parse.lua

<snipped>

> -- 
> 2.32.0
> 

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2021-08-14  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 13:42 [Tarantool-patches] [PATCH luajit v2 0/2] memprof: group allocations on traces by trace number Mikhail Shishatskiy via Tarantool-patches
2021-07-28 13:42 ` [Tarantool-patches] [PATCH luajit v2 1/2] memprof: dump traceno if allocate from trace Mikhail Shishatskiy via Tarantool-patches
2021-08-14  8:00   ` Sergey Kaplun via Tarantool-patches [this message]
2021-07-28 13:42 ` [Tarantool-patches] [PATCH luajit v2 2/2] memprof: extend symtab with info about traces Mikhail Shishatskiy via Tarantool-patches
2021-08-14 11:03   ` Sergey Kaplun via Tarantool-patches

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=YRd4M1l/st30pPNS@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.shishatskiy@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v2 1/2] memprof: dump traceno if allocate from trace' \
    /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