News, tips, partners, and perspectives for the Oracle Solaris operating system

Virtual Address Reservation in Solaris 11.3

For applications that have a need to place memory at fixed locations in its
address space (like the Oracle SGA), there is a new feature in
Solaris 11.3 called Virtual Address Reservation that provides support
for such
fixed address mappings. A fixed address mapping today can fail if the
system has already assigned a mapping to the desired location. As the
system is free to choose any unused region in a process' address space for
mapping things such as libraries, such conflicts could arise.  Worse yet, if MAP_FIXED mmap(2) were used by the application, it would be
successful but any existing mapping could be destroyed.

Virtual Address Reservation in Solaris 11.3 provides the means to 'reserve' a portion of a
process' address space which will prevent the system from using the reserved
space for mapping operations that don't specify a fixed address. The VA
Reservations guarantee that fixed address mappings would be successful.

To create a VA Reservation requires that the application be
with a Mapfile (version 2) containing the RESERVE_SEGMENT directive that
specifies the virtual address range to reserve. Multiple RESERVE_SEGMENT directives can be specified in the Mapfile to create multiple VA Reservations. The Mapfile below would
reserve the VA range from 0x300000000 to 0x300400000. 

# cat Mapfile

$mapfile_version 2

RESERVE_SEGMENT myReservedVaName {

        VADDR = 0x300000000;

        SIZE = 0x400000;


# cc file.c -Mmapfile -m64

On execution of the resultant a.out binary, the specified virtual address range will be reserved early on during process startup and before libraries are mapped. pmap(1) can be run on the running process to see its VA reservation(s); it can be seen in the pmap output as "[ reserved ]". 

0000000100000000        32K r-x----  /a.out

0000000100106000         8K rwx----  /a.out

0000000300000000      4096K -------  [ reserved ]

FFFFFFFF7F200000      2112K r-x----  /lib/sparcv9/libc.so.1


To use the reserved space, the application simply needs to
specify a fixed address that corresponds to the Reserved VA range on
calls to
either mmap(2) or shmat(2).

Please note that VA Reservation only addresses possible conflicts related to
fixed address mappings.  Applications that use fixed address
mappings should be well aware of other potential problems.
For instance, my example above (on SPARC) reserves the VA Address space
starting at 0x300000000.  This could cause malloc
failures if the process is memory intensive and the Heap needs to be grow larger than 8G (heap starts at around 0x100106000 and cannot grow past 0x300000000). 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha