Observed with Ubuntu 20.04 (kernel 5.15, glibc 2.31):
Our guard pages (created with mprotect PROT_NONE) still count as "accountable" VMAs. The glibc's guard pages do not, even though they are also created with mprotect PROT_NONE. See smaps:
GLIBC guard page:
```
7ff15f582000-7ff15f583000 ---p 00000000 00:00 0
Size: 4 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 0 kB
...
VmFlags: mr mw me sd
```
Our guard pages:
```
7ff15f583000-7ff15f587000 ---p 00000000 00:00 0
Size: 16 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 0 kB
Pss: 0 kB
...
VmFlags: mr mw me ac sd <<<< AC is set
```
This has two negative effects:
1) our guard pages still count toward the OOM killer
2) in situations where both glibc guard page and Java guard pages are active, the two VMAs cannot be merged into one; that means that we pay, for each thread, with 3 VMAs (thread stack, our guard page, glibc guard page). This may cause us to exhaust the maximum number of allowed mappings earlier.
(2) is an issue when THPs are enabled and we therefore enable glibc guard pages atop of JVM guard pages to prevent formation of inter-thread-stack VMAs (seeJDK-8312182).
Our guard pages (created with mprotect PROT_NONE) still count as "accountable" VMAs. The glibc's guard pages do not, even though they are also created with mprotect PROT_NONE. See smaps:
GLIBC guard page:
```
7ff15f582000-7ff15f583000 ---p 00000000 00:00 0
Size: 4 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 0 kB
...
VmFlags: mr mw me sd
```
Our guard pages:
```
7ff15f583000-7ff15f587000 ---p 00000000 00:00 0
Size: 16 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 0 kB
Pss: 0 kB
...
VmFlags: mr mw me ac sd <<<< AC is set
```
This has two negative effects:
1) our guard pages still count toward the OOM killer
2) in situations where both glibc guard page and Java guard pages are active, the two VMAs cannot be merged into one; that means that we pay, for each thread, with 3 VMAs (thread stack, our guard page, glibc guard page). This may cause us to exhaust the maximum number of allowed mappings earlier.
(2) is an issue when THPs are enabled and we therefore enable glibc guard pages atop of JVM guard pages to prevent formation of inter-thread-stack VMAs (see
- relates to
-
JDK-8312182 THPs cause huge RSS due to thread start timing issue
- Resolved