RESOLVED FIXED 128261
GC timer should intelligently choose between EdenCollections and FullCollections
https://bugs.webkit.org/show_bug.cgi?id=128261
Summary GC timer should intelligently choose between EdenCollections and FullCollections
Mark Hahnenberg
Reported 2014-02-05 10:58:03 PST
Most of the GCs while browsing the web are due to the GC timer. Currently the GC timer always does FullCollections. To reduce the impact of the GC timer on the system we should add some logic to intelligently schedule both EdenCollections and FullCollections.
Attachments
straw man (18.40 KB, patch)
2014-03-13 10:53 PDT, Mark Hahnenberg
no flags
straw man 2 (19.11 KB, patch)
2014-03-13 11:07 PDT, Mark Hahnenberg
no flags
Patch (50.91 KB, patch)
2014-03-18 12:29 PDT, Mark Hahnenberg
no flags
Patch (50.88 KB, patch)
2014-03-18 14:26 PDT, Mark Hahnenberg
no flags
Patch (51.92 KB, patch)
2014-03-18 14:49 PDT, Mark Hahnenberg
no flags
Patch (51.85 KB, patch)
2014-03-18 15:06 PDT, Mark Hahnenberg
no flags
Patch (51.94 KB, patch)
2014-03-18 16:04 PDT, Mark Hahnenberg
no flags
Patch (51.97 KB, patch)
2014-03-18 16:24 PDT, Mark Hahnenberg
no flags
Patch (51.97 KB, patch)
2014-03-18 17:48 PDT, Mark Hahnenberg
no flags
Patch (51.97 KB, patch)
2014-03-18 18:37 PDT, Mark Hahnenberg
ggaren: review+
Mark Hahnenberg
Comment 1 2014-03-13 10:53:46 PDT
Created attachment 226599 [details] straw man
Early Warning System Bot
Comment 2 2014-03-13 10:55:15 PDT
Attachment 226599 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Hahnenberg
Comment 3 2014-03-13 11:07:54 PDT
Created attachment 226600 [details] straw man 2
Geoffrey Garen
Comment 4 2014-03-13 12:28:34 PDT
Comment on attachment 226600 [details] straw man 2 View in context: https://bugs.webkit.org/attachment.cgi?id=226600&action=review r=me Please test PLT before landing this. Plus a few fixups below. > Source/JavaScriptCore/heap/GCActivityCallback.cpp:-97 > if (heap->isPagedOut(startTime + pagingTimeOut)) { > - heap->activityCallback()->cancel(); EdenCollection probably should not do the isPagedOut check. I think isPagedOut touches the whole heap, so that's not great for Eden. Also, EdenCollection is more likely to find free space than FullCollection, so I think it should be less conservative about whether collection is "worth it". > Source/JavaScriptCore/heap/GCActivityCallback.cpp:112 > + heap->setShouldDoFullCollection(true); > heap->collect(); I think it would be a slightly better abstraction to pass a collection type to collect(), rather than setting a data member. Perhaps the Heap implements things internally in terms of a data member, but clients need not know that detail. > Source/JavaScriptCore/heap/Heap.cpp:281 > + , m_fullActivityCallback(GCActivityCallback::createFullTimer(this)) > + , m_edenActivityCallback(GCActivityCallback::createEdenTimer(this)) If GenGC is disabled, both pointers should point to the same callback, and it should be a full callback. That way, we can still A/B test GenGC on vs off. > Source/JavaScriptCore/heap/Heap.cpp:340 > - if (m_activityCallback) > - m_activityCallback->didAllocate(m_bytesAllocatedThisCycle + m_bytesAbandonedThisCycle); > + if (m_fullActivityCallback) > + m_fullActivityCallback->didAllocate(m_sizeAfterLastCollect + m_bytesAbandonedThisCycle); This is pretty aggro. The first abandoned object graph reports that it abandoned the whole heap! I think you want this instead: m_sizeAfterLastCollect - m_sizeAfterLastFullCollect + m_bytesAllocatedThisCycle + m_bytesAbandonedThisCycle That way, we only report our growth since the last full collect. Also: You should rename m_bytesAbandonedThisCycle to m_bytesAbandonedSinceLastFullCollect, and change it so that it only resets to 0 during a full collect. Our theory of abandoned object graphs is that they should hasten full collections, so we should not reset the abandoned counter during eden collections. For example, if I navigate between three websites, and do three eden collections, I still want to do a full collection soon.
Mark Hahnenberg
Comment 5 2014-03-18 12:29:01 PDT
Mark Hahnenberg
Comment 6 2014-03-18 14:26:09 PDT
Mark Hahnenberg
Comment 7 2014-03-18 14:49:45 PDT
Mark Hahnenberg
Comment 8 2014-03-18 15:06:46 PDT
Mark Hahnenberg
Comment 9 2014-03-18 16:04:53 PDT
Mark Hahnenberg
Comment 10 2014-03-18 16:24:01 PDT
Mark Hahnenberg
Comment 11 2014-03-18 17:48:08 PDT
Mark Hahnenberg
Comment 12 2014-03-18 18:37:56 PDT
Geoffrey Garen
Comment 13 2014-03-19 13:30:58 PDT
Comment on attachment 227142 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227142&action=review r=me > Source/JavaScriptCore/heap/EdenGCActivityCallback.cpp:57 > + return double(sizeBefore - sizeAfter) / double(sizeBefore); static_cast<double> is more our style.
Mark Hahnenberg
Comment 14 2014-03-19 15:22:22 PDT
WebKit Commit Bot
Comment 15 2014-03-19 17:15:53 PDT
Re-opened since this is blocked by bug 130488
Andy Estes
Comment 16 2014-03-19 17:19:58 PDT
This broke linking WebCore on iOS: Undefined symbols for architecture x86_64: "__ZN3JSC22FullGCActivityCallback12doCollectionEv", referenced from: __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22FullGCActivityCallback11gcTimeSliceEm", referenced from: __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC18GCActivityCallback11willCollectEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22FullGCActivityCallback12lastGCLengthEv", referenced from: __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22FullGCActivityCallback9deathRateEv", referenced from: __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "_wkQueryDecoderAvailability", referenced from: -exported_symbol[s_list] command line option "__ZN3JSC18GCActivityCallback6doWorkEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22EdenGCActivityCallback12doCollectionEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC18GCActivityCallback6cancelEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22EdenGCActivityCallback9deathRateEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC18GCActivityCallback11didAllocateEm", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o __ZTVN7WebCore29WebSafeFullGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22EdenGCActivityCallback12lastGCLengthEv", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o "__ZN3JSC22EdenGCActivityCallback11gcTimeSliceEm", referenced from: __ZTVN7WebCore29WebSafeEdenGCActivityCallbackE in JSDOMWindowBase.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Mark Hahnenberg
Comment 17 2014-03-19 18:56:54 PDT
Note You need to log in before you can comment on or make changes to this bug.