On 2.6.32 and 3.4-rc6 mmap failure of a huge page causes a memory
leak. The 32 byte kmalloc cache grows by 10 mio entries if running
the following code:
--------
#include <sys/mman.h>
#include <stdlib.h>
#ifndef MAP_HUGETLB
#define MAP_HUGETLB 0x0040000
#endif
int main() {
for (int i=0; i!=10000000; ++i) {
void* ptr=mmap(NULL, 2*1024*1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB, 0, 0);
if (ptr!=MAP_FAILED) abort();
}
return 0;
}
-------
g++ -O2 test.cpp && echo good
good
$ egrep 'SUnreclaim|HugePages_Total' /proc/meminfo
SUnreclaim: 1900756 kB
HugePages_Total: 0
$ ./a.out && echo good
good
$ egrep 'SUnreclaim|HugePages_Total' /proc/meminfo
SUnreclaim: 2213268 kB
HugePages_Total: 0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>
[Site Home]
[Linux ARM Kernel]
[Linux ARM]
[Linux Omap]
[Fedora ARM]
[IETF Annouce]
[Security]
[Bugtraq]
[Linux]
[Linux OMAP]
[Linux MIPS]
[ECOS]
[Tools]
[DDR & Rambus]
[Asterisk Internet PBX]
[Linux API]
[Monitors]