You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we probably want LJ_PRNG_BITS(J, LJ_TARGET_JUMPRANGE-16) there, otherwise we may be wasting cycles on architectures with LJ_TARGET_JUMPRANGE < 31
to get a block within the [target - range; target + range) range (since range is already half the available jump range) we want to check hint + sz against range * 2, then subtract range.
This is likely a minor issue for x86, where the available jump range is big. This becomes a big problem for architectures where the available range is already small (e.g. ARM64 with the +-128 MB range) and there are many parallel threads, amplifying contention on mmap() that I reported earlier in the mailing list.
The text was updated successfully, but these errors were encountered:
Since 'range' in mcode_alloc() is calculated based on
LJ_TARGET_JUMPRANGE-1, i.e. already half the available jump range, don't
divide it by 2 again for randomized allocations.
Also fix the number of bits argument to LJ_PRNG_BITS() to not generate
excessive bits on architectures with LJ_TARGET_JUMPRANGE < 31. That
wouldn't play well with the 0x78b constant being XORed with the
generated random number apparently to improve PRNG properties, so that
part has been removed. Improving PRNG will be addressed separately.
The random address selection loop in mcode_alloc() unnecessarily reduces the available allocation range by 2 times:
Two problems here:
LJ_PRNG_BITS(J, LJ_TARGET_JUMPRANGE-16)
there, otherwise we may be wasting cycles on architectures withLJ_TARGET_JUMPRANGE < 31
[target - range; target + range)
range (sincerange
is already half the available jump range) we want to checkhint + sz
againstrange * 2
, then subtractrange
.This is likely a minor issue for x86, where the available jump range is big. This becomes a big problem for architectures where the available range is already small (e.g. ARM64 with the +-128 MB range) and there are many parallel threads, amplifying contention on
mmap()
that I reported earlier in the mailing list.The text was updated successfully, but these errors were encountered: