host_statistics sometimes blocks for 1 second on iOS 11

Originator:ben
Number:rdar://34571117 Date Originated:9/21/2017
Status:Open Resolved:
Product:xnu Product Version:iOS 11.0
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
The attached program makes a call to host_statistics when you press the button:

  host_statistics(mach_host_self(), HOST_VM_INFO64, (host_info_t)&vmstat, &count)

The HOST_VM_INFO64 flavor is used to get detailed memory statistics about free/cached memory levels on the device, e.g. number of file backed pages, number of free pages, and number of purgeable pages in the system.

Prior to iOS 11, this syscall always returned extremely quickly (< 1 ms) which is expected since it seems to just copy out some integers from kernel to user space. However, in iOS 11, sometimes the call takes almost exactly 1 second, indicating some sort of 1 second timeout in the kernel.

Steps to Reproduce:
Run the attached app. Tap the button some number of times (tapping the button quick succession usually will start resulting in the 1 second hang). Notice that the syscall takes 1 second to complete.

Expected Results:
The syscall should complete almost instantaneously, as it did before iOS 11.

Actual Results:
The syscall sometimes takes 1 second to complete.

Version/Build:
iOS 10.3.3 (no hang) => iOS 11.0 (hang)

Configuration:
iPhone 6S

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!