Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip aligned allocation on SV39 MMUs #949

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Sep 21, 2024

  1. CMakeLists.txt: check /proc/cpuinfo for an SV39 MMU

    If the host has an SV39 MMU, the usual aligned hinting strategy will
    not work despite the system being 64-bit. On RISC-V linux systems, the
    type of MMU can be read from /proc/cpuinfo. If we find one, a constant
    is defined that will allow us to skip the aligned hinting when the
    time comes.
    orlitzky committed Sep 21, 2024
    Configuration menu
    Copy the full SHA
    a407780 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2024

  1. src/os.c: skip aligned hinting when MI_SV39_MMU=1 is defined

    This constant will be defined when the host has an SV39 MMU. The usual
    2TiB+ hinting strategy will not work on those systems, so we skip it,
    just as we would if the system was not "64-bit."
    orlitzky committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    53440ad View commit details
    Browse the repository at this point in the history
  2. src/os.c: avoid doomed alloc/free on 32-bit and SV39 systems

    On 32-bit or SV39 systems, _mi_os_get_aligned_hint() in src/os.c is
    ifdef'd to always return NULL. As a result, the OS prim allocation
    routines using that hint will fail to obtain aligned memory. When that
    happens, we free() the result, and overallocate.
    
    But this is wasteful: we know that (with high probability) the first
    attempt at an aligned allocation will fail. This commit modifies
    mi_os_prim_alloc_aligned() to skip the doomed alloc and subsequent
    free using the same ifdef condition that is used to disable the hint.
    orlitzky committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    4f1a420 View commit details
    Browse the repository at this point in the history