In ZGC, when a page become old it needs a remembered set (remset) which stores 2 bits per byte (2/64) resulting in a memory overhead of 3.125%.
When the old page is potentially freed and inserted in the page cache, it can later be re-used as a young page. In this case, the remset is still allocated even though the young page does not need a remset. This is especially noteworthy for long-running programs where pages are recycled for a long enough period to have a remset allocated for close to all pages.
The attached plot shows remset memory usage for a program that frequently recycles pages using a cahe-mechanism. As remsets for young pages are unused, it should be considered wasted memory.
Instead of keeping the remset when an old page is inserted into the page cache, the remset should be deleted/freed instead to not waste memory. This would mean that no remsets are stored for young pages, but only old pages.
When the old page is potentially freed and inserted in the page cache, it can later be re-used as a young page. In this case, the remset is still allocated even though the young page does not need a remset. This is especially noteworthy for long-running programs where pages are recycled for a long enough period to have a remset allocated for close to all pages.
The attached plot shows remset memory usage for a program that frequently recycles pages using a cahe-mechanism. As remsets for young pages are unused, it should be considered wasted memory.
Instead of keeping the remset when an old page is inserted into the page cache, the remset should be deleted/freed instead to not waste memory. This would mean that no remsets are stored for young pages, but only old pages.
- relates to
-
JDK-8339163 ZGC: Race in clearing of remembered sets
- Resolved
- links to
-
Commit(master) openjdk/jdk/37ec80df
-
Review(master) openjdk/jdk/20947