RFR (preliminary): 8202772: "NMT erroneously assumes thread stack boundaries to be page aligned"
Zhengyu Gu
zgu at redhat.com
Thu Jun 7 13:24:18 UTC 2018
On 06/07/2018 09:21 AM, Thomas Stüfe wrote:
> On Thu, Jun 7, 2018 at 3:12 PM, Zhengyu Gu <zgu at redhat.com> wrote:
>>
>>>
>>> Next escalation would be to disable thead stack accounting just on
>>> AIX. Or, platforms where thread stacks have not-page-aligned
>>> boundaries. Or, dynamically on a by-thread base.
>>>
>>> Are thread stack regions merged in NMT? So, two threads laying side by
>>> side, could they be merged to one region with mtThreadStack attribute?
>>>
>> I don't think we merge individually reserved memory, but committed memory
>> within the same reserved memory range.
>>
>> I don't think it will be hard to pull thread stacks into another tracking
>> list. Matter of fact, it might simplify a few things, as we started doing
>> something special the thread stacks, e.g. figuring out actual stack range in
>> used and where are guard pages.
>>
>> I will file a RFE.
>>
>
> Sounds good!
BTW: https://bugs.openjdk.java.net/browse/JDK-8204552
Thanks,
-Zhengyu
>
> ..Thomas
>
>> Thanks,
>>
>> -Zhengyu
>>
>>
>>
>>
>>> ..Thomas
>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> -Zhengyu
>>>>
>>>>
>>>>>
>>>>> My first attempt at fixing this (see above webrev) was to feed NMT a
>>>>> corrected version of the thread stack size - just the page-aligned
>>>>> inner portion of the stack - that way we loose a bit fidelity in NMT
>>>>> thread stack accounting, but at least we do not crash. That makes
>>>>> runtime errors go away, but there is a gtest which stubbornly refuses
>>>>> to heal.
>>>>>
>>>>> See CommittedVirtualMemoryTest
>>>>> (test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp): I admit
>>>>> I do not fully understand this test. It seems to record the current
>>>>> threads stack base and size - ok - and then query the virtual regions
>>>>> as perceived by NMT, expecting that the stack top is at the end of a
>>>>> committed region. But even without the matter of unaligned stack base,
>>>>> could it not be that virtual regions in NMT are fused, e.g. if
>>>>> multiple thread stacks are placed next to each other? So, I am not
>>>>> sure the test if correct.
>>>>>
>>>>> Would be nice if someone with more NMT knowledge could comment.
>>>>>
>>>>> --
>>>>>
>>>>> Please note: Since I do most of my development on Linux, I modified
>>>>> the stack base in the preliminary patch a bit to emulate the same
>>>>> error on Linux I get on AIX. Because AIX is a terrible platform to
>>>>> debug on :)
>>>>>
>>>>> Note that the VM usually is fine with unaligned stack bases - NMT is
>>>>> the only part I know of which has problems with that.
>>>>>
>>>>> --
>>>>>
>>>>> Thanks a lot,
>>>>>
>>>>> Best Regards, Thomas
>>>>>
>>>>
>>
More information about the hotspot-runtime-dev
mailing list