Re: Android performance drop moving from LuaJIT-2.0.1 -> LuaJIT-2.0.2 ?

  • From: Mike Pall <mike-1309@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 5 Sep 2013 02:28:01 +0200

Kriss@xxxxxxxx wrote:
> By a process of just reverting files between the two versions I have
> pinpointed exactly what is going wrong. Not really sure why it is bad for
> me and not anyone else?
> 
> The change is in lj_mcode.c,
>
>   const uintptr_t range = (1u << (LJ_TARGET_JUMPRANGE-1)) - (1u << 21);

[Well, I'm relieved it's not an isue with cache syncing. But ...]

Please print or log the address of lj_vm_exit_handler (e.g. in
lua_newstate), then take a look at the memory map /proc/self/maps
or /proc/$pid/maps after running for a while. There should be
enough free memory around this address in the +-32 MB ARM branch
range.

The JIT-compiler tries to grab 32 KB blocks from that area and
will do random probes until if finds one. That could be costly if
this fails too often. You can check whether this is the problem by
adding some logging to the end of mcode_alloc() where it punts.

[There was another thread about a Tegra-based device in April.
When I debugged that I noticed the whole memory map was full of
tiny 4K mappings against /dev/nvmap. I'm not sure whether that's
normal or not. From a quick search, I'm under the impression that
device should be opened once per process and not hundreds of
times. Maybe something is leaking graphic driver handles or such?]

--Mike

Other related posts: