Bug 164375 - Reduce number of malloc_zone_pressure_relief calls
Summary: Reduce number of malloc_zone_pressure_relief calls
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-03 13:15 PDT by Keith Rollin
Modified: 2016-12-05 15:28 PST (History)
4 users (show)

See Also:


Attachments
Patch (5.08 KB, patch)
2016-11-03 15:00 PDT, Keith Rollin
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews123 for ios-simulator-wk2 (11.00 MB, application/zip)
2016-11-03 16:18 PDT, Build Bot
no flags Details
Crash not reproducing locally so retrying EWS. (5.15 KB, patch)
2016-11-10 15:44 PST, Keith Rollin
no flags Details | Formatted Diff | Diff
Patch (1.91 KB, patch)
2016-11-29 14:18 PST, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 2016-11-03 13:15:50 PDT
From Gavin:

WebKit’s memory pressure handler is currently calling malloc_zone_pressure_relief twice; for apps using WK1 this can cause a large stall on the app’s main thread.

The call under ReliefLogger::platformMemoryUsage is something we’re doing purely for logging purposes – this is not a reasonable burder to incur. We should remove this, and adjust our logging appropriately.

<rdar://problem/29048286>
Comment 1 Keith Rollin 2016-11-03 15:00:40 PDT
Logging now looks like this by default:

14:37:33.447467 -0700	Memory pressure relief: Empty the PageCache
14:37:33.447537 -0700	Memory pressure relief: Prune MemoryCache live resources
14:37:33.447744 -0700	Memory pressure relief: Drain CSSValuePool
14:37:33.447806 -0700	Memory pressure relief: Discard StyleResolvers
14:37:33.467145 -0700	Memory pressure relief: Discard all JIT-compiled code
14:37:33.467235 -0700	Memory pressure relief: Dropping buffered data from paused media elements
...

It looks as it used it if someone manually enables it with `defaults write -g LogMemoryJetsamDetails 1`:

14:40:34.698681 -0700	Memory pressure relief: Empty the PageCache: -dirty 94208 bytes (from 25477120 to 25382912)
14:40:34.699715 -0700	Memory pressure relief: Prune MemoryCache live resources: -dirty 491520 bytes (from 25382912 to 24891392)
14:40:34.700456 -0700	Memory pressure relief: Drain CSSValuePool: -dirty 4096 bytes (from 24891392 to 24887296)
14:40:34.702059 -0700	Memory pressure relief: Discard StyleResolvers: -dirty 57344 bytes (from 24887296 to 24829952)
14:40:34.703430 -0700	Memory pressure relief: Discard all JIT-compiled code: -dirty 28672 bytes (from 24829952 to 24801280)
14:40:34.703950 -0700	Memory pressure relief: Dropping buffered data from paused media elements: =dirty (at 24801280 bytes)
...
Comment 2 Keith Rollin 2016-11-03 15:00:50 PDT
Created attachment 293808 [details]
Patch
Comment 3 Build Bot 2016-11-03 16:18:04 PDT
Comment on attachment 293808 [details]
Patch

Attachment 293808 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2456820

New failing tests:
media/controls/ipad/close-page-with-picture-in-picture-video-assertion-failure.html
Comment 4 Build Bot 2016-11-03 16:18:07 PDT
Created attachment 293821 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 5 Keith Rollin 2016-11-10 15:44:51 PST
Created attachment 294425 [details]
Crash not reproducing locally so retrying EWS.
Comment 6 Andreas Kling 2016-11-11 13:17:17 PST
Comment on attachment 294425 [details]
Crash not reproducing locally so retrying EWS.

r=me
Comment 7 WebKit Commit Bot 2016-11-11 13:53:17 PST
Comment on attachment 294425 [details]
Crash not reproducing locally so retrying EWS.

Clearing flags on attachment: 294425

Committed r208607: <http://trac.webkit.org/changeset/208607>
Comment 8 WebKit Commit Bot 2016-11-11 13:53:21 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Keith Rollin 2016-11-28 13:58:50 PST
Reverted r208607 for reason:

The actual changes aren't inline with what was requested.

Committed r209014: <http://trac.webkit.org/changeset/209014>
Comment 10 Keith Rollin 2016-11-29 14:18:42 PST
Created attachment 295638 [details]
Patch
Comment 11 Darin Adler 2016-12-03 12:41:51 PST
Comment on attachment 295638 [details]
Patch

Looks fine. Did Kling look at this too?
Comment 12 Andreas Kling 2016-12-03 13:46:57 PST
Comment on attachment 295638 [details]
Patch

Looks fine to me, although the bug title is wrong since we're not changing the number of calls to platformMemoryUsage() :)
Comment 13 WebKit Commit Bot 2016-12-05 15:28:15 PST
Comment on attachment 295638 [details]
Patch

Clearing flags on attachment: 295638

Committed r209360: <http://trac.webkit.org/changeset/209360>
Comment 14 WebKit Commit Bot 2016-12-05 15:28:20 PST
All reviewed patches have been landed.  Closing bug.