RFR: JDK-8307356: Metaspace: simplify BinList handling [v4]
Thomas Stuefe
stuefe at openjdk.org
Thu Aug 17 06:34:42 UTC 2023
> In preparation for Lilliput, I'd like to simplify BinList handling a bit.
>
> BinList are a data structure that stores small blocks that had been prematurely deallocated for re-use. Due to the way BinList is implemented, it cannot store blocks smaller than two words. That causes complexities in metaspace and makes estimating memory usage awkward (important for testing). We can eliminate this complexity by shrinking a Block to just one word.
>
> ----
>
> Details:
>
> A BinList block before:
> ``` Block { Block* next; size_t size; }```
> A BinList block now:
> ``` Block { Block* next; }```
>
> We don't need to store the block size, since all blocks in a single sub-list have the same size. In fact, we used the block size only for verification.
>
> With this patch, gross- and net-allocation sizes in Metaspace are the same for 64-bit (see `get_raw_word_size_for_requested_word_size`), which will make writing tests that try to predict metaspace usage based on allocation pattern a lot less onerous to write. For 32-bit, unfortunately, we still need to align allocation sizes to 2 words since allocation addresses need to be aligned to 64-bit.
Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'openjdk:master' into metaspace-binlist-rework
- Feedback David
- feedback roman
- BinList changes
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13776/files
- new: https://git.openjdk.org/jdk/pull/13776/files/909b1f9e..83567b10
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13776&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13776&range=02-03
Stats: 427209 lines in 6688 files changed: 261263 ins; 118591 del; 47355 mod
Patch: https://git.openjdk.org/jdk/pull/13776.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13776/head:pull/13776
PR: https://git.openjdk.org/jdk/pull/13776
More information about the hotspot-runtime-dev
mailing list