-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improper DEFAULT_MAX_NURSERY? #723
Comments
That's not true, right? I don't remember noticing this while I fixed the nursery size options. The function which actually controls a full-heap GC is Did you have a trace showcasing this behaviour you've mentioned? EDIT: See here [2, 3]. [1]: mmtk-core/src/plan/generational/global.rs Lines 147 to 193 in 9edb453
[2]:
[3]:
|
If |
So in other words, only highly allocating/generational workloads work as intended... Hmm. From memory we discussed that a large nursery limit was fine since it's the "unbounded" nursery. Surely one can argue that nursery size is a tuning parameter specific to each workload and in order to get best performance, they may have to tune it? |
It is not about work load. It is max nursery size and heap size. If max nursery size is larger than heap size, we will not have nursery GCs. For example, the default max nursery value (1G) is very likely to be larger than normal 2x-6x heap sizes we use for most dacapo benchmarks. If that happens, we will not see nursery GCs. I believe we have the same issue for Java MMTk. But their default max nursery is 32M, which is more likely to be smaller than usual heap sizes we use for Dacapo.
Right. You would need to set nursery size along with heap size, and make sure they match each other. |
Can we gather stats on this? I feel like something is amiss -- I don't remember getting Number of GC ~ Number of major GCs. There is a counter for the major GCs, so we should be able to know how many nursery GCs happen. |
For example, the following always triggers full heap GCs. The default max nursery is 1G, and the heap size is set to 80M. The heap is full before the nursery is full -- so every GC is full heap.
[2023-01-02T22:40:11Z INFO mmtk::memory_manager] Initialized MMTk with GenImmix
===== DaCapo fop starting =====
[2023-01-02T22:40:12Z INFO mmtk::util::heap::gc_trigger] [POLL] nursery: Triggering collection
[2023-01-02T22:40:12Z INFO mmtk::plan::generational::global] Full heap GC
[2023-01-02T22:40:12Z INFO mmtk::scheduler::gc_work] End of GC
[2023-01-02T22:40:13Z INFO mmtk::util::heap::gc_trigger] [POLL] nursery: Triggering collection
[2023-01-02T22:40:13Z INFO mmtk::plan::generational::global] Full heap GC
[2023-01-02T22:40:13Z INFO mmtk::scheduler::gc_work] End of GC
===== DaCapo fop PASSED in 1348 msec ===== If you set
[2023-01-02T22:26:19Z INFO mmtk::memory_manager] Initialized MMTk with GenImmix
===== DaCapo fop starting =====
[2023-01-02T22:26:20Z INFO mmtk::util::heap::gc_trigger] [POLL] nursery: Triggering collection
[2023-01-02T22:26:20Z INFO mmtk::plan::generational::global] Nursery GC
[2023-01-02T22:26:20Z INFO mmtk::scheduler::gc_work] End of GC
[2023-01-02T22:26:20Z INFO mmtk::util::heap::gc_trigger] [POLL] nursery: Triggering collection
[2023-01-02T22:26:20Z INFO mmtk::plan::generational::global] Nursery GC
[2023-01-02T22:26:20Z INFO mmtk::scheduler::gc_work] End of GC
[2023-01-02T22:26:20Z INFO mmtk::util::heap::gc_trigger] [POLL] nursery: Triggering collection
[2023-01-02T22:26:20Z INFO mmtk::plan::generational::global] Nursery GC
[2023-01-02T22:26:20Z INFO mmtk::scheduler::gc_work] End of GC
===== DaCapo fop PASSED in 1359 msec ===== |
This run is from a while ago but is from my PR comment here (#630 (comment)), but it seems like the |
Yes this is reproducible on current mmtk-core For
But not reproducible on mmtk-core For
So the regression was introduced between August 2022 and January 2023. The most likely candidate is the GC trigger one: 2300ce1. The static cost of a GC unfortunately outweighs the gains from nursery GC, so the older commit is slower (than non-generational counterpart) as discussed here #594 and previous meetings. |
Thanks @k-sareen . I figured out why it could trigger nursery GCs in 8afe96d, but not in the current master. The problem I talked about in this issue also exists in 8afe96d: GC is triggered because of heap being full (not nursery being full). The difference is after the GC is triggered, The difference is from another change in 2300ce1. L72 ( Lines 69 to 72 in 06237f1
This is what happens for
[2023-01-04T04:52:52Z TRACE mmtk::plan::generational::global] nursery = 9864, max nursery =268435456
// Nursery is not full
[2023-01-04T04:52:52Z DEBUG mmtk::plan::global] self.get_reserved_pages()=20483, self.get_total_pages()=20480
// But heap is full - Do GC
[2023-01-04T04:52:52Z INFO mmtk::plan::global] [POLL] nursery: Triggering collection
// Clear current pending allocation pages (reserved pages is now 20467 down from 20483)
[2023-01-04T04:52:52Z TRACE mmtk::plan::generational::global] full heap? false (total 20480, reserve 20467)
// So heap is not full - Do nursery GC
[2023-01-04T04:52:52Z INFO mmtk::plan::generational::global] Nursery GC
[2023-01-04T04:52:52Z INFO mmtk::scheduler::gc_work] End of GC Though this triggers a nursery GC, I don't feel this is intended. I would say it was a bug that makes it possible to trigger nursery GCs in |
Going by the GC Handbook, what we want is an Appel-style nursery (Chapter 9, pg. 121). A heap-full collection should always be nursery GC unless the nursery space is less than some minimum threshold (i.e. the Edit: I agree that it just happened to work for the previous commit, but I would posit a heap-full collection for an Appel-style nursery should not be a full-heap GC. Full-heap GCs should only occur if-and-when the nursery size (i.e. reserved pages) is less than the minimum nursery size (2 MB iirc). This would be consistent with Appel-style nursery and generational hypothesis. |
I think the terminology of "heap-full" and "full-heap" is perhaps confusing us. Heap-full is just when we are out of space to allocate. I don't see why a full-heap GC is required for that case, since theoretically we could reclaim enough space with a nursery GC in order to service the allocation and continue the program. A full-heap GC should only happen if the nursery is too small to allocate further into and/or if the virtual memory is exhausted which is a similar case. (Maybe we should rename "heap-full" to something else?) |
Our current
DEFAULT_MAX_NURSERY
is set to 1G on 64bits machine.mmtk-core/src/util/options.rs
Line 83 in 9edb453
According to
collection_required()
inGen
, nursery is not considered as full (to trigger a nursery GC) unless its reserved pages reach the max nursery size (1G).mmtk-core/src/plan/generational/global.rs
Lines 114 to 115 in 9edb453
If the heap size is smaller than 1G and we do not set nursery size explicitly, we always trigger full heap GCs, and never trigger a nursery GC.
The text was updated successfully, but these errors were encountered: