RFR: 8280289: Enhance debug pp() command with NMT info [v3]
Thomas Stuefe
stuefe at openjdk.java.net
Sat Jan 22 09:08:08 UTC 2022
On Fri, 21 Jan 2022 17:22:12 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
>> JDK-8275320 enhanced NMT malloc header, provided ability to identify if a pointer points to a malloc'd memory. Further, JDK-8277822 enabled NMT for debug builds.
>>
>> This is a good opportunity to integrate NMT to debug pp() command to provide useful information collected by NMT.
>>
>> For example:
>>
>> NMT=summary
>>
>> (gdb) call pp(0x7f2d9803db70)
>> "Executing pp"
>> 0x00007f2d9803db70 malloc'd 1576 bytes by Internal
>>
>> (gdb) call pp(0x00007f4300a20000)
>> "Executing pp"
>> 0x00007f4300a20000 in mmap'd memory region [0x00007f4300a20000 - 0x00007f4310000000] by GC
>>
>>
>> NMT=detail
>>
>>
>> (gdb) call pp(0x7f2d9803db70)
>> "Executing pp"
>> 0x00007f2d9803db70 malloc'd 1576 bytes by Internal
>> [0x00007f2d9f1b784b] G1Arguments::create_heap()+0x1b
>> [0x00007f2d9f98a855] universe_init()+0x85
>> [0x00007f2d9f2e0a97] init_globals()+0x37
>> [0x00007f2d9f960acb] Threads::create_vm(JavaVMInitArgs*, bool*)+0x3db
>>
>> (gdb) call pp(0x00007f4300a20000)
>> "Executing pp"
>> 0x00007f4300a20000 in mmap'd memory region [0x00007f4300a20000 - 0x00007f4310000000] by GC
>> [0x00007f433dc49c7f] reserve_memory(char*, unsigned long, unsigned long, int, bool)+0x17f
>> [0x00007f433dc4cf0b] ReservedSpace::reserve(unsigned long, unsigned long, unsigned long, char*, bool)+0x14b
>> [0x00007f433dc4d527] ReservedSpace::initialize(unsigned long, unsigned long, unsigned long, char*, bool)+0x1c7
>> [0x00007f433d949d40] ShenandoahHeap::initialize()+0x340
>
> Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:
>
> Missing include file
Some small remaining nitpicks.
src/hotspot/share/services/virtualMemoryTracker.cpp line 683:
> 681:
> 682: bool do_allocation_site(const ReservedMemoryRegion* rgn) {
> 683: if (_p >= rgn->base() && _p < rgn->base() + rgn->size()) {
Use `VirtualMemoryRegion::contain_address()`?
src/hotspot/share/services/virtualMemoryTracker.cpp line 693:
> 691: };
> 692:
> 693: const ReservedMemoryRegion* VirtualMemoryTracker::find_region(void* p) {
Curious, is this thread-safe? Do we care if not?
src/hotspot/share/utilities/debug.cpp line 496:
> 494: p2i(p), p2i(rgn->base()), p2i(rgn->base() + rgn->size()), rgn->flag_name());
> 495: if (tracking_level == NMT_detail) {
> 496: rgn->call_stack()->print_on(tty);
Idea for later cleanup. In detail mode, malloc headers have no call stack (NULL) whereas regions have an empty stack (NativeCallStack::_empty_stack) ? If yes, may be nice to unify this behavior.
Maybe also remove checks like this here, for MemTracker::tracking_level=detail, in favor of checking if rgn->call_stack() is NULL. That would feel more consistent and allow us (if we ever wanted) to have regions with and without stack.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7160
More information about the hotspot-dev
mailing list