autosuspend
autosuspend copied to clipboard
Autosuspend should respect systemd inhibit locks
Autosuspend currently only evaluates the idle hint of logind sessions. However, it should also consider inhibit locks.
From man logind.conf(5)
's IdleAction
description:
Note that this requires that user sessions correctly report the idle status to the system. The system will execute the action after all sessions report that they are idle, no idle inhibitor lock is active, and subsequently, the time configured with IdleActionSec= (see below) has expired.
Ideally autosuspend would not perform idle checks if an idle inhibit lock is taken and consider the system active. And not invoke suspend if a sleep inhibit lock is taken.
This could be added a another activity check.
This could be added a another activity check.
It could, but it would be slightly changing the semantic of the (idle) inhibit lock. The system's idle period would then start once the inhibit lock is released. When it should start once the last session became idle.
Is that a serious problem for your use case? Due to the periodic nature of autosuspend there's always a chance that (in)activity is missed or detected only delayed. I never had the ambition to build a tool that suspends the system accurately to the second. For saving energy, suspending one or two minutes later every now and then shouldn't be a real problem?
I was just pointing out that there is a semantic difference between a non-idle session and a idle inhibit lock.
For saving energy, suspending one or two minutes later every now and then shouldn't be a real problem?
I think it's more then just a minute or two. Once the idle inhibit lock is gone, the system could be already idle long enough right away. Instead you have to wait the whole idle_time
again.