[linux] mmap should use MAP_FIXED_NOREPLACE if available

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 22
    • Affects Version/s: 22
    • Component/s: hotspot
    • b13
    • linux

      os::attempt_reserve_memory_at() is used to map memory at a specific address that we fancy. It is not used to replace an existing mapping (hence we omit MAP_FIXED).

      But it may result in the kernel creating a mapping at a different address if our wish address is blocked; we then have to unmap again. That mmap-munmap cycle is unnecessary.

      MAP_FIXED_NOREPLACE has existed since Linux 4.17 and prevents that unnecessary cycle . We should use that if available.

            Assignee:
            Thomas Stuefe
            Reporter:
            Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: