Does mmap with MAP_NORESERVE have backup physical memory?

The mmap documentation contains the following information about the MAP_NORESERVE flag.

Do not reserve swap space for this mapping. When the swap space is reserved, one has a guarantee that the display can be changed. When the swap space is not reserved, you can get SIGSEGV on write if physical memory is not available.

In reality, I only want to reserve virtual memory addresses and not allocate actual physical memory. Can this be done using mmap with MAP_NORESERVE? If I want to use some kind of physical memory, I would simulate it again using MAP_FIXED in a range of addresses within one located through mmap with MAP_NORESERVE.

To summarize, I want the kernel not to reserve any physical page for memory allocated using mmap with the flag MAP_NORSERVE. Does it really work that way or does the kernel allocate physical pages if it has enough physical memory?

+5
source share
3 answers

Mmap () is one way to manage the relationship between {address, physical memory, disk blocks}. All three members of this association are resources. The link is stored inside page table entries (PTE)

What mmap () really does:

  • [] . ( )
  • PTE
  • PTE ​​ mmap() ed
  • [] ()
  • [] .

(3 5) , mmap(). (fd -1: , start-address NULL: mmap () )

mmap() , . ( , , COW,...)

swapspace , , . , , . ( ) , . ( : mmap() )

+4

linux mmap , , MAP_NORESERVE , , .

MAP_FIXED , ( ) , , , .

+3

mmap(). (.. , , 1995?), mmap, , , .

+3

All Articles