Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8313319

[linux] mmap should use MAP_FIXED_NOREPLACE if available

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • 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.

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

              Created:
              Updated:
              Resolved: