Bug 154254

Summary: Add mechanism to disable memory pressure handling
Product: WebKit Reporter: Keith Rollin <krollin>
Component: WebCore Misc.Assignee: Keith Rollin <krollin>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=186663
Attachments:
Description Flags
Patch
none
Patch none

Description Keith Rollin 2016-02-15 13:31:32 PST
For debugging purposes, it would be handy to disable this.
Comment 1 Radar WebKit Bug Importer 2016-02-15 13:58:40 PST
<rdar://problem/24662616>
Comment 2 Radar WebKit Bug Importer 2016-02-15 13:58:43 PST
<rdar://problem/24662620>
Comment 3 Keith Rollin 2016-02-17 10:56:34 PST
Created attachment 271566 [details]
Patch
Comment 4 Chris Dumez 2016-02-17 12:02:43 PST
Comment on attachment 271566 [details]
Patch

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

So this impacts the freeing of memory when the process gets suspended as well. Is it intentional? This is not technically memory pressure even though we use more or less the same code for both cases.

> Source/WebKit/mac/ChangeLog:23
> +        In actuality, only the WebContent and Network processes heed the flag.

How about the UIProcess? See for example on iOS:
/Volumes/Data/WebKit/OpenSource/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm

It does not seem to be impacted by your patch but it probably should.
Comment 5 Chris Dumez 2016-02-17 12:20:35 PST
(In reply to comment #4)
> Comment on attachment 271566 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271566&action=review
> 
> So this impacts the freeing of memory when the process gets suspended as
> well. Is it intentional? This is not technically memory pressure even though
> we use more or less the same code for both cases.
> 

Apparently it is alright. But then, we also want to do it in the WebProcess suspension case as well: see MemoryPressureHandler::singleton().releaseMemory(Critical::Yes, Synchronous::Yes); calls in WebProcess.cpp.
Comment 6 Keith Rollin 2016-02-18 13:45:43 PST
> How about the UIProcess? See for example on iOS:
> /Volumes/Data/WebKit/OpenSource/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm

I've added a check in that function and updated the check-in comment.

>> So this impacts the freeing of memory when the process gets suspended as
>> well. Is it intentional? This is not technically memory pressure even though
>> we use more or less the same code for both cases.

> Apparently it is alright. But then, we also want to do it in the WebProcess
> suspension case as well: see
> MemoryPressureHandler::singleton().releaseMemory(Critical::Yes, Synchronous::Yes); calls in WebProcess.cpp.

I've added a check here, too.
Comment 7 Keith Rollin 2016-02-18 13:47:25 PST
Created attachment 271688 [details]
Patch
Comment 8 Chris Dumez 2016-02-22 09:43:59 PST
Comment on attachment 271688 [details]
Patch

r=me
Comment 9 WebKit Commit Bot 2016-02-22 10:30:59 PST
Comment on attachment 271688 [details]
Patch

Clearing flags on attachment: 271688

Committed r196943: <http://trac.webkit.org/changeset/196943>
Comment 10 WebKit Commit Bot 2016-02-22 10:31:05 PST
All reviewed patches have been landed.  Closing bug.