RFR: 8272807: Permit use of memory concurrent with pretouch
Aleksey Shipilev
shade at openjdk.java.net
Fri Feb 4 16:21:07 UTC 2022
On Fri, 4 Feb 2022 12:31:10 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Intentionally didn't write it that way, because of the potential for UB pointer arithmetic overflow in `cur += page_size`.
>
> Also, that won't touch the last page when first page != last page, unless the last page is made exclusive, which calculation could also suffer from UB pointer arithmetic overflow. Of course, the caller could suffer from that too; we can't so easily fix that. Representing address ranges as [start, end) just generally suffers from that problem.
All right, what irked me originally is that `cur == last` break assumes both `cur` and `last` are multiples of `page_size`, otherwise this loops "indefinitely" (until successive overflows help, I guess). This is true now, but it is not even asserted. Maybe it should be `cur >= last`?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7343
More information about the hotspot-runtime-dev
mailing list