Re: [PATCH 4/4] alarmtimer: Hold wakeup source on resume for imminent alarms
From: John Stultz
Date: Wed Dec 02 2026 - 14:24:07 EST
On Mon, Nov 30, 2026 at 10:13 PM Samuel Wu <wusamuel@xxxxxxxxxx> wrote:
>
> The RTC can wake a device from suspend up to 1s before the alarm is due to
> fire, because of the RTC's 1s granularity. This means during the resume
> path of suspend, an alarm can be due within the next second.
>
> So to prevent even starting a doomed suspend attempt, check for imminent
> alarms and hold a wakeup source to appropriately gate future suspend
> attempts. This also saves an unnecessary filesystem sync.
>
> Failed suspend attempts due to alarmtimer are significantly reduced on a
> Pixel 9 (v7.3) running Android, and QEMU x86_64 (v7.4) with kernel
> autosleep.
>
> Signed-off-by: Samuel Wu <wusamuel@xxxxxxxxxx>
Acked-by: John Stultz <jstultz@xxxxxxxxxx>