Bug 232976 - Log memory usage metadata when WebContent crosses critical or warning level memory thresholds
Summary: Log memory usage metadata when WebContent crosses critical or warning level m...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ben Nham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-10 18:02 PST by Ben Nham
Modified: 2021-11-11 12:41 PST (History)
8 users (show)

See Also:


Attachments
Patch (31.29 KB, patch)
2021-11-10 18:17 PST, Ben Nham
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (31.41 KB, patch)
2021-11-10 18:29 PST, Ben Nham
no flags Details | Formatted Diff | Diff
patch for landing (31.59 KB, patch)
2021-11-11 11:12 PST, Ben Nham
no flags Details | Formatted Diff | Diff
patch for landing (31.68 KB, patch)
2021-11-11 11:16 PST, Ben Nham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Nham 2021-11-10 18:02:49 PST
We receive a large number of out of memory reports without enough logging info to properly debug. We should log more metadata about memory usage (similar to what we do on Mac in `WebCore::logMemoryStatisticsAtTimeOfDeath`) to help us debug those reports.
Comment 1 Ben Nham 2021-11-10 18:17:34 PST
Created attachment 443891 [details]
Patch
Comment 2 Ben Nham 2021-11-10 18:19:00 PST
<rdar://85171163>
Comment 3 Ben Nham 2021-11-10 18:29:01 PST
Created attachment 443894 [details]
Patch
Comment 4 Darin Adler 2021-11-11 10:09:23 PST
Comment on attachment 443894 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=443894&action=review

> Source/WTF/wtf/cocoa/ResourceUsageCocoa.cpp:140
> +            // Count all resident malloc pages as dirty.
> +            size_t dirtyPages = info.pages_resident - info.pages_reusable;
> +            tags[info.user_tag].dirty += dirtyPages + info.pages_swapped_out;

Do we really need a local variable just to add pages_swapped_out?

> Source/WTF/wtf/cocoa/ResourceUsageCocoa.cpp:143
> +            tags[info.user_tag].dirty += (info.pages_dirtied + info.pages_swapped_out);

Not sure the parentheses add clarity here.

> Source/WebCore/page/MemoryRelease.h:34
> +enum class LogMemoryStatisticsReason {

: uint8_t?

> Source/WebKit/WebProcess/WebProcess.cpp:464
> +                // Log stats in the next turn of the run loop so that it runs after the low memory handler.

This comment is here, but not above. Does the same rationale apply above?
Comment 5 Ben Nham 2021-11-11 11:12:47 PST
Created attachment 443977 [details]
patch for landing
Comment 6 Ben Nham 2021-11-11 11:16:15 PST
Created attachment 443979 [details]
patch for landing
Comment 7 EWS 2021-11-11 12:41:08 PST
Committed r285648 (244148@main): <https://commits.webkit.org/244148@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 443979 [details].