RFR(XS) 8191369: NMT: Enhance thread stack tracking
Zhengyu Gu
zgu at redhat.com
Wed Nov 15 22:25:28 UTC 2017
This is Linux only enhancement for now, can be extended for other
platforms. (See bug for details)
Current implementation, thread stack is tracked when thread is created,
its available stack space is tagged as reserved and committed.
However, this is not how stack works. Stack pages are committed on
demand, so this approach overstates its memory usage.
This enhancement gathers thread stack usage at NMT query time, so that
it can report more accurate usage.
Bug: https://bugs.openjdk.java.net/browse/JDK-8191369
Webrev: http://cr.openjdk.java.net/~zgu/8191369/webrev.00/index.html
Example:
Summary shows thread stacks only use small faction of reserved space.
- Thread (reserved=41216KB, committed=632KB)
(thread #41)
(stack: reserved=41032KB, committed=448KB)
(malloc=137KB #222)
(arena=47KB #76)
Detail tracking shows stack guards and actually used/committed stack area.
[0x00007f66e95e7000 - 0x00007f66e96e8000] reserved 1028KB for Thread
Stack from
[0x00007f67c0b57d5c] JavaThread::run()+0x2c
[0x00007f67c08bbea2] thread_native_entry(Thread*)+0x112
[0x00007f66e95e7000 - 0x00007f66e95eb000] committed 16KB from
[0x00007f67c08b7319] os::pd_create_stack_guard_pages(char*,
unsigned long)+0x29
[0x00007f67c0b56851] JavaThread::create_stack_guard_pages()
[clone .part.125]+0xa1
[0x00007f67c0b57d6e] JavaThread::run()+0x3e
[0x00007f67c08bbea2] thread_native_entry(Thread*)+0x112
[0x00007f66e96e7000 - 0x00007f66e96e8000] committed 4KB
Thanks,
-Zhengyu
More information about the hotspot-runtime-dev
mailing list