-
Enhancement
-
Resolution: Fixed
-
P3
-
8u40, 9
-
b11
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8059355 | 9 | Thomas Schatzl | P3 | Resolved | Fixed | b35 |
JDK-8083087 | emb-9 | Thomas Schatzl | P3 | Resolved | Fixed | b35 |
JDK-8063342 | 8u45 | Thomas Schatzl | P3 | Resolved | Fixed | b01 |
JDK-8071078 | emb-8u47 | Thomas Schatzl | P3 | Resolved | Fixed | team |
Test checking that native memory is returning to the system.
---- Details from Thomas Schatzl -----
Main testing should be in the area of
a) not breaking existing functionality - the feature is completely
transparent to the VM and
b) memory usage reductions.
What the feature does:
- uncommits parts of the Java heap and auxiliary data according to the
current sizing policy (e.g. HeapMin/MaxFreeRatio) at full GCs.
Full GCs are the only point in time where the heap is decreased.
The release (uncommit) of this data is based on regions. I.e. the unit
of memory freeing is regions, when a region is freed, all its associated
auxiliary data should go away as required.
There is one complication in this matter, and that is that the unit of
commit/uncommit is always OS memory pages, but an OS page worth of
auxiliary data may cover multiple regions. If one of these regions is
still not uncommitted, the auxiliary data cannot be freed either.
This ratio between OS memory page size and region size is not fixed too,
both OS memory page size and region size can vary depending on flags
(UseLargePages etc).
The change is G1 only too.
So, what are the relevant memory consumers:
- Java heap: split into disjoint regions, given G1RegionSize (range 1M
to 32M, power of two increments); can be managed either with "OS page
size" or large pages (-XX:+UseLargePages active).
- Auxiliary data:
contents of auxiliary data always map directly to a disjoint
contiguous section of the Java heap. Their memory is *always* managed in
native page size.
- Two mark bitmaps, where each bit maps to an area of
MinObjAlignmentInBytes * BitsPerByte bits.
MinObjAlignmentInBytes can vary from 8 (default) to 256 iirc (actually I
cannot find a bound, but it must be a power of two).
This amounts to ~3% of heap space by default; if 4k pages are used (e.g.
on x86), a single page spans 256k of heap (i.e. only a fraction of a
region in any case) - but with increasing MinObjAlignmentInBytes a
single page may span multiple regions.
- Three "tables" (card table, offset table, hot card cache count)
where in each element of them spans an area of 512 bytes. This is
hardcoded at this time.
The hot card cache count table is only used if it is enabled
(G1ConcRSLogCacheSize is larger than zero).
E.g. with 4k pages, each of them span 2 MB of heap.
In total they make up 0.6% of the Java heap.
Current status:
- there is a prototype available (for creating tests) that manages the
Java heap, the mark bitmaps, and one of the mentioned tables.
So I think you can already start working on tests.
Planned date that this feature to be finished and in the repos is 9th of
June. It may be delayed slightly because we did not plan my vacation (I
talked to Paul about this already) into that time.
I will start getting reviews for the first changes next week.
Difficulties I see here:
- getting reliable information of actual uncommitted memory. I.e. it is
not only important that the VM reports that the heap shrank, but actual
memory usage (e.g. RSS size or whatever) adjusted correctly (i.e. that
the commit/uncommit calls are made correctly).
Also somehow the amount of memory committed/uncommitted what the VM
thinks should probably be checked.
- there is a fairly large amount of possible combinations of settings
that should be checked.
- getting the VM to reliably uncommit a particular area. Possibly best
achievable using large object allocations.
---- Details from Thomas Schatzl -----
Main testing should be in the area of
a) not breaking existing functionality - the feature is completely
transparent to the VM and
b) memory usage reductions.
What the feature does:
- uncommits parts of the Java heap and auxiliary data according to the
current sizing policy (e.g. HeapMin/MaxFreeRatio) at full GCs.
Full GCs are the only point in time where the heap is decreased.
The release (uncommit) of this data is based on regions. I.e. the unit
of memory freeing is regions, when a region is freed, all its associated
auxiliary data should go away as required.
There is one complication in this matter, and that is that the unit of
commit/uncommit is always OS memory pages, but an OS page worth of
auxiliary data may cover multiple regions. If one of these regions is
still not uncommitted, the auxiliary data cannot be freed either.
This ratio between OS memory page size and region size is not fixed too,
both OS memory page size and region size can vary depending on flags
(UseLargePages etc).
The change is G1 only too.
So, what are the relevant memory consumers:
- Java heap: split into disjoint regions, given G1RegionSize (range 1M
to 32M, power of two increments); can be managed either with "OS page
size" or large pages (-XX:+UseLargePages active).
- Auxiliary data:
contents of auxiliary data always map directly to a disjoint
contiguous section of the Java heap. Their memory is *always* managed in
native page size.
- Two mark bitmaps, where each bit maps to an area of
MinObjAlignmentInBytes * BitsPerByte bits.
MinObjAlignmentInBytes can vary from 8 (default) to 256 iirc (actually I
cannot find a bound, but it must be a power of two).
This amounts to ~3% of heap space by default; if 4k pages are used (e.g.
on x86), a single page spans 256k of heap (i.e. only a fraction of a
region in any case) - but with increasing MinObjAlignmentInBytes a
single page may span multiple regions.
- Three "tables" (card table, offset table, hot card cache count)
where in each element of them spans an area of 512 bytes. This is
hardcoded at this time.
The hot card cache count table is only used if it is enabled
(G1ConcRSLogCacheSize is larger than zero).
E.g. with 4k pages, each of them span 2 MB of heap.
In total they make up 0.6% of the Java heap.
Current status:
- there is a prototype available (for creating tests) that manages the
Java heap, the mark bitmaps, and one of the mentioned tables.
So I think you can already start working on tests.
Planned date that this feature to be finished and in the repos is 9th of
June. It may be delayed slightly because we did not plan my vacation (I
talked to Paul about this already) into that time.
I will start getting reviews for the first changes next week.
Difficulties I see here:
- getting reliable information of actual uncommitted memory. I.e. it is
not only important that the VM reports that the heap shrank, but actual
memory usage (e.g. RSS size or whatever) adjusted correctly (i.e. that
the commit/uncommit calls are made correctly).
Also somehow the amount of memory committed/uncommitted what the VM
thinks should probably be checked.
- there is a fairly large amount of possible combinations of settings
that should be checked.
- getting the VM to reliably uncommit a particular area. Possibly best
achievable using large object allocations.
- backported by
-
JDK-8059355 CMM Testing: 8u40 Decommit auxiliary data structures
- Resolved
-
JDK-8063342 CMM Testing: 8u40 Decommit auxiliary data structures
- Resolved
-
JDK-8071078 CMM Testing: 8u40 Decommit auxiliary data structures
- Resolved
-
JDK-8083087 CMM Testing: 8u40 Decommit auxiliary data structures
- Resolved
- relates to
-
JDK-8280016 gc/g1/TestShrinkAuxiliaryData30 test fails on large machines
- Resolved
-
JDK-8038423 G1: Decommit memory within the heap
- Resolved
(1 relates to)