Much Faster Suspend & Resume For Some Systems With Linux 6.14

The ACPI change worth highlighting for Linux 6.14 is switching from msleep() to usleep_range() within the acpi_os_sleep() call in the kernel. This reduces spurious sleep time due to timer inaccuracy. Linux ACPI/PM maintainer Rafael Wysocki of Intel who authored this change noted that it could "spectacularly" reduce the duration of system suspend and resume transitions on some systems.
Among the many systems affected are for this bug report from July 2022 over Thunderbolt on Dell XPS laptops taking 8 seconds to suspend and 8 seconds to resume. Another report suggesting this ACPI change noted another Dell XPS laptop going from a kernel resume time of 1.9 seconds down to 1.1 seconds.
Rafael explained in the patch making the sleep change:
"The extra delay added by msleep() to the sleep time value passed to it can be significant, roughly between 1.5 ns on systems with HZ = 1000 and as much as 15 ms on systems with HZ = 100, which is hardly acceptable, at least for small sleep time values.
msleep(5) on the default HZ = 250 in Ubuntu on a modern PC takes about 12 ms. This results in over 800 ms of spurious system resume delay on systems such as the Dell XPS-13-9300, which use ASL Sleep(5ms) in a tight loop.
Address this by using usleep_range() in acpi_os_sleep() instead of msleep(). For short sleep times this is a no brainer, but even for long sleeps usleep_range() should be preferred because timer wheel timers are optimized for cancelation before they expire and this particular timer is not going to be canceled."
This suspend and resume improvement was merged as part of the ACPI updates for the Linux 6.14 kernel.
24 Comments