NEW 183277
MemoryPressureHandler's dispatch_source_set_timer uses s_minimumHoldOffTime as nanoseconds
https://bugs.webkit.org/show_bug.cgi?id=183277
Summary MemoryPressureHandler's dispatch_source_set_timer uses s_minimumHoldOffTime a...
Yusuke Suzuki
Reported 2018-03-01 23:00:53 PST
...
Attachments
Ryan Reno
Comment 1 2023-08-01 10:26:11 PDT
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.
Note You need to log in before you can comment on or make changes to this bug.