RFR: 8298293: NMT: should os::realloc() API take flags as arguments?
Thomas Stuefe
stuefe at openjdk.org
Mon Feb 6 06:35:51 UTC 2023
On Fri, 3 Feb 2023 23:02:53 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> Please review this enhancement, which adds `assert` to make sure that we are not changing the NMT flags when calling `os::realloc()`
>
> We also fix a bug, which the `assert` caught.
>
> Passes Mach5 tier1,2,3,4,5
LGTM. Maybe this would have been better before 8297718, but it's good now too.
Which buffer was this? How many buffers are there (malloced before VM init, grown afterward)?
If we really go down that route, we should benefit from it and remove some of the complexities:
- remove MEMFLAGS from os::realloc() and NMTPreInit::handle_realloc() - why should caller have to specify this if the only allowed value is the one in the malloc header
- optionally: add MEMFLAGS to NMTPreInit::handle_malloc() and carry it around in the *preinit* malloc header too (see struct NMTPreInitAllocation); so that NMTPreInit::handle_realloc() can use this MEMFLAGS to call os::malloc() in case of buffer-grow-after-VMinit. But we could skip this part and keep things simple. The only penalty would be that these kind of buffers are then accounted with NMT default category; if we only have one of these buffers, or two, maybe its fine.
- Part of the complexity added by 8297718 is not needed anymore; some of it may be simplified
Cheers, Thomas
-------------
Marked as reviewed by stuefe (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12422
More information about the hotspot-runtime-dev
mailing list