Locking shared memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



        I have a database application that creates some shared memory
segments to be used by several programs. Most of the shared memory is
used as a buffer pool for I/O so all the programs do not have to do
physical reads from the disk. Because shared memory is implemented on
Linux as a memory mapped file, it means the memory pages can get swapped
out if space is needed in memory and the page has not been accessed
recently.

        Therefore I want to lock the shared memory pages in physical
memory so they can not be swapped. Currently I am allocating 2 256MB
shared memory segments for a total of 512MB. When I make the call to
mlock() for the first segment it returns with a good status. But mlock()
fails for the second segment with errno set to ENOMEM. Here is what the
man page for mlock() says about errors.

================================================================== 
       The mlock() and munlock() functions shall fail if: 

       ENOMEM Some or all of the address range specified by the addr and
len 
              arguments  does  not  correspond  to  valid mapped pages
in the 
              address space of the process. 

       The mlock() function shall fail if: 

       EAGAIN Some or all of the memory identified by the operation
could not 
              be locked when the call was made. 

       The mlock() and munlock() functions may fail if: 

       EINVAL The addr argument is not a multiple of {PAGESIZE}. 

       The mlock() function may fail if: 

       ENOMEM Locking the pages mapped by the specified range would
exceed an 
              implementation-defined limit on the amount of memory  that
the 
              process may lock. 

       EPERM  The  calling process does not have the appropriate
privilege to 
              perform the requested operation. 
=================================================================== 
I do not think the error is because of the first explanation of ENOMEM
So my question is based on the second one. 

Is there a kernel or vm parameter that controls how much memory a
process can utilize? 

I am running RH AS 4.4 32 bit with 2GB of physical memory. 

Thanks in advance: 
Jack Allen 

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subjecthttps://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux