Bug 13192

Summary: ENOMEM when shmat of pre-existing hugepage segment at explicit virtual address
Product: Memory Management Reporter: starlight
Component: OtherAssignee: Andrew Morton (akpm)
Status: RESOLVED DUPLICATE    
Severity: normal CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.29.1 Subsystem:
Regression: Yes Bisected commit-id:

Description starlight 2009-04-27 03:45:22 UTC
$ strace -e shmget,shmat app1
shmget(0x2038272, 0, SHM_HUGETLB|0)     = 196614
shmat(196614, 0, SHM_RDONLY)            = ?  # success

$ strace -e shmget,shmat app2
shmget(0x2038282, 0, SHM_HUGETLB|0)     = 0
shmat(0, 0x400000000, SHM_RDONLY)       = -1 ENOMEM (Cannot allocate memory)


$ ipcs -m                                                               
                                                                        
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x02038282 0          user      640        1073741824 1
0x02038281 32769      user      640        268435456  1
0x02038273 65538      user      640        2097152    2
0x02038283 98307      user      660        134217728  2
0x0203827d 131076     user      600        174063616  1
0x0203827b 163845     user      660        134217728  1
0x02038272 196614     user      640        2097152    1
0x0203827c 229383     user      600        100663296  1
0x02038252 262152     user      640        536870912  1
0x02038271 294921     user      660        2097152    0


$ cat /proc/meminfo
MemTotal:       16471800 kB
MemFree:        10934688 kB
Buffers:           51220 kB
Cached:           999912 kB
SwapCached:            0 kB
Active:            71580 kB
Inactive:         978404 kB
Active(anon):      11676 kB
Inactive(anon):        0 kB
Active(file):      59904 kB
Inactive(file):   978404 kB
Unevictable:       57632 kB
Mlocked:           57632 kB
SwapTotal:       2031608 kB
SwapFree:        2031608 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         61160 kB
Mapped:            10984 kB
Slab:             167472 kB
SReclaimable:      46872 kB
SUnreclaim:       120600 kB
PageTables:         2064 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8170356 kB
Committed_AS:      92404 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      304464 kB
VmallocChunk:   34359422651 kB
HugePages_Total:    2048
HugePages_Free:      890
HugePages_Rsvd:      844
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        7872 kB
DirectMap2M:    16769024 kB



$ dmesg | head -3
Initializing cgroup subsys cpuset
Linux version 2.6.29.1 (user@tlachtga) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) ) #1 SMP Sat Apr 25 22:10:06 EDT 2009
Command line: ro root=/dev/vg09/lv90 console=ttyS0,115200 hugepages=2048



Works fine under RHEL/CentOS 5.3 kernel 2.6.18-128.1.6.el5
Comment 1 starlight 2009-04-27 03:52:47 UTC
Same bug as Bug 12134 except five months later I saw
it from a different angle.
Comment 2 Alan 2012-05-30 16:29:41 UTC

*** This bug has been marked as a duplicate of bug 12134 ***