Bug 183277
Summary: | MemoryPressureHandler's dispatch_source_set_timer uses s_minimumHoldOffTime as nanoseconds | ||
---|---|---|---|
Product: | WebKit | Reporter: | Yusuke Suzuki <ysuzuki> |
Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | rreno |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 182911 | ||
Bug Blocks: |
Yusuke Suzuki
...
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ryan Reno
Ran across this FIXME when working on something else. I think this parameter is pretty benign as-is but there might be some risk keeping it.
This is the leeway parameter which is documented below: (https://developer.apple.com/documentation/dispatch/1385606-dispatch_source_set_timer/)
>The leeway parameter is a hint from the application as to the amount of time, in >nanoseconds, up to which the system can defer the timer to align with other system >activity for improved system performance or power consumption. For example, an >application might perform a periodic task every 5 minutes, with a leeway of up to 30 >seconds. Note that some latency is to be expected for all timers, even when a leeway >value of zero is specified.
So we're basically telling the system it can delay firing the timer by an upper limit of 5 ns. Since this is a hold off timer for re-installing the memory pressure handler (presumably to minimize responding to rapid ping-pong between memory pressure states?) I think 5 seconds is far too long of a leeway but 5ns is probably a little on the short side.
All that is to say I think unless we measure that we are responding to memory pressure too slowly and can confirm it is due to leeway parameter we might as well just make it 0 or maybe some other value that doesn't imply we mean for it to be 5 seconds.