RFR: 8328944: NMT reports "unknown" memory
Thomas Stuefe
stuefe at openjdk.org
Mon Nov 4 13:33:31 UTC 2024
On Mon, 4 Nov 2024 13:12:52 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> > > Eventually the goal would be not to use mtNone anywhere, but we are not there quite yet.
> >
> >
> > I think this is neither realistic nor desirable. mtNone means "don't know yet; will do later". This is perfectly valid for cases where
> > ```
> > * you allocate something on behalf of someone else; obviously, you don't know what he intends to do with it
> >
> > * when you reserve a range that is later shared by multiple tags.
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > If we move to more fine granular tags, or something like hierarchical tags, the latter point will become more important. Therefore, mtNone has its place.
>
> It seems to me like the first case isn't a case at all, as that someone else can always give you a tag for the memory.
The requirement of having to funnel MemTags through call chains makes the code brittle and inflexible to work with. You need to modify every single call frame to marshall that tag through to the eventual place where it gets tracked.
Apart from that hassle, you may not even know. An allocator can allocate a range en-block and hand it out piecemeal to different users. Currently, that whole range is then tagged as belonging to the allocator, which is a bit useless tbh. E.g. the full class space range is tagged as mtClass. Every ResourceArea chunk is tagged as RA. That is very coarse-granular, and there is no way to have finer-grained tagging. I often wished for that at customer sites.
Bottomline, allocation operations on the system level don't necessarily map 1:1 to NMT semantic tagging. We should not hard-code this requirement into NMT. It limits the future usefulness of NMT, and/or limits how we allow ourselves to allocate memory (which should always take the most efficient route and not be limited by what NMT can or can't do).
> With more granular or hierarchical tags, the case for `mtNone` seems even rarer. We can then always have a top-level tag for the category: `mtCardTable <: mtGC`.
>
> Now I'm just thinking out loud: `mtNone` could be renamed to `mtAny` in the case that we do have hierarchical tags, as to represent `top` in a partially ordered set.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21843#issuecomment-2454725202
More information about the shenandoah-dev
mailing list