Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 236662 - Sun 32-bit JVM unable to allocate large pages memory greater than 2147483648 bytes
Summary: Sun 32-bit JVM unable to allocate large pages memory greater than 2147483648 ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Larry Woodman
QA Contact: Martin Jenner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-04-17 01:33 UTC by Shrinivas Joshi
Modified: 2007-11-17 01:14 UTC (History)
5 users (show)

Fixed In Version: RHBA-2007-0791
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-11-15 16:25:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0791 normal SHIPPED_LIVE Updated kernel packages available for Red Hat Enterprise Linux 4 Update 6 2007-11-14 18:25:55 UTC

Description Shrinivas Joshi 2007-04-17 01:33:26 UTC
Description of problem:
Sun JVM exits with error:
Java HotSpot(TM) Server VM warning: Failed to reserve shared memory (errno = 22)
when it tries to allocate heap > 1980M and is configured to use large page
support. The OS trace generated using strace command shows that the cause of the
problem is call to shmget syscall.

Version-Release number of selected component (if applicable):
Dual-core AMD Opteron 870 4 processor system (8 cores). 8G system memory.
The problem is probably reproducible on other x86_64 systems with memory greater
than 4G
RHEL 4 update 3, 2.6.9-34.ELsmp, x86_64 
Sun 32-bit JVM 1.5 build 6

How reproducible:
Try to initialize JVM process on above mentioned system configuration.

Steps to Reproduce:
1. Install Sun JVM 32-bit 1.5 build 6 or above
2. Configure the system to enable large pages after OS reboot (to avoid
fragmentation)
 a. echo 8589934591 > /proc/sys/kernel/shmmax //All 8G shareable
 b. echo 3072 > /proc/sys/vm/nr_hugepages //6G for large pages of 2048K each
 c. verify whether large pages are allocated using cat /proc/meminfo;
HugePagesTotal and HugePagesFree should be equal to 3072
3. Start installed JVM process using:
<java-install-path>/bin/java -Xms1984M -Xmx1984M -XX:+UseLargePages -version
Problem is in fact reproducible for any -Xms and -Xmx values greater than 1980M,
however make sure that the requested memory aligns to 2M pages (1980M, 1982M,
1984M ...)
  
Actual results:
JVM exits with error:
Java HotSpot(TM) Server VM warning: Failed to reserve shared memory (errno = 22)

Expected results:
JVM should successfully allocate requested memory using large pages support

Additional info: It appears that the call to shmget fails due to max permissible
value of its second parameter "size" in 32-bit compatibility mode. However even
in 32-bit compatibility mode the "size" parameter which is of type unsigned long
should allow values <= 2^32 (4G) rather than 2^31 (2G, signed long max value)

Comment 1 Jakub Jelinek 2007-04-17 02:37:41 UTC
This has nothing to do with compat-libs (which have been only shipped in RHEL2.1
and never since then).

Comment 2 Larry Woodman 2007-04-17 17:16:54 UTC
I doubt we can change this without breaking the ABI.  Even worse, this is the
syscall interface so changing this will break user applications.  Basically
32-bit compatibility mode limits system V shared memory regions to 231-1 because
sys32_ipc() uses ints for args.

-----------------------------------------------------------------------------------------
asmlinkage long
sys32_ipc(u32 call, int first, int second, int third,
               compat_uptr_t ptr, u32 fifth)
{
       int version;
                                                                               
                            
       version = call >> 16; /* hack for backward compatibility */
       call &= 0xffff;
                                                                               
                            
       switch (call) {
               ..........
             case SHMGET:
               return sys_shmget(first, second, third);
               -------
      }
}
----------------------------------------------------------------------------------------


Larry Woodman



Comment 3 Larry Woodman 2007-04-18 15:40:35 UTC
I made this upstream change to RHEL4 and it seems to fix the problem:

--------------------------------------------------------------------------
--- linux-2.6.9/arch/x86_64/ia32/ipc32.c.orig
+++ linux-2.6.9/arch/x86_64/ia32/ipc32.c
@@ -49,7 +49,7 @@ sys32_ipc(u32 call, int first, int secon
              case SHMDT:
                return sys_shmdt(compat_ptr(ptr));
              case SHMGET:
-               return sys_shmget(first, second, third);
+               return sys_shmget(first, (unsigned)second, third);
              case SHMCTL:
                return compat_sys_shmctl(first, second, compat_ptr(ptr));
        }
--------------------------------------------------------------------------

I built a new kernel located here can you try it out and let me know if its OK
with you???

>>>http://people.redhat.com/~lwoodman/rhel4/


Larry Woodman


Comment 4 Bhavna Sarathy 2007-05-15 13:12:33 UTC
This fix results in a 5-10% increase improvement in SPECjAppServer benchmark and
AMD would like customers to have this fix before RHEL4.6 which will release in
Oct 24.  AMD would like to request a kernel errata with this fix made available
to customers.  The actual performance gain will depend on the SUT configuration
and with injection rates of > 450 the performance will improve considerably.



Comment 5 Russell Doty 2007-07-10 21:52:10 UTC
Peter M. indicates that it was ACK'd by Rik and Alan on 4/19/2007. Larry Woodman
says he will make sure Jason commits the patch, he does know about it.
        
        

Comment 6 RHEL Product and Program Management 2007-07-10 21:54:58 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 9 Jason Baron 2007-07-31 20:25:32 UTC
committed in stream U6 build 55.6. A test kernel with this patch is available
from http://people.redhat.com/~jbaron/rhel4/


Comment 13 errata-xmlrpc 2007-11-15 16:25:10 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0791.html



Note You need to log in before you can comment on or make changes to this bug.