RFR: Fix allocate aligned [v3]
Y. Srinivas Ramakrishna
ysr at openjdk.org
Thu Jan 5 08:14:17 UTC 2023
On Thu, 5 Jan 2023 01:41:45 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> An error was discovered in the implementation and use of allocate_aligned(), which is used to allocate PLABs that align with remembered set card boundaries. In the previous implementation, if the required alignment padding was smaller than the minimum filler object, the additional card's memory worth of padding might cause the PLAB to span beyond the end of the selected heap region. This PR addresses the error. This code successfully runs our internal pipeline of tests without any regressions.
>>
>> In the current context, this code is not fully exercised due to very limited allocation of PLABs within heap regions that already hold previously allocated PLABs. This code has also been exercised in the context of code that more aggressively packs multiple PLABs into heap regions. That additional code will be integrated with a future PR.
>
> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove redundant test for result != nullptr
Changes look fine.
I'd like to understand the original rationale for making PLAB boundaries exactly card-aligned. Perhaps it's described/documented somewhere in the code? (Something to do with simplifying card-scanning concurrently with allocating out of PLABs?)
src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 317:
> 315: assert(result != nullptr, "Allocation cannot fail");
> 316: assert(r->top() <= r->end(), "Allocation cannot span end of region");
> 317: assert(req.actual_size() % CardTable::card_size_in_words() == 0, "PLAB start must align with card boundary");
"PLAB should be card size multiple"
(the next assert checks alignment)
-------------
Marked as reviewed by ysr (Author).
PR: https://git.openjdk.org/shenandoah/pull/192
More information about the shenandoah-dev
mailing list