Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosuspend should respect systemd inhibit locks #408

Open
Flowdalic opened this issue Aug 16, 2023 · 4 comments
Open

Autosuspend should respect systemd inhibit locks #408

Flowdalic opened this issue Aug 16, 2023 · 4 comments

Comments

@Flowdalic
Copy link

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.

@languitar
Copy link
Owner

This could be added a another activity check.

@Flowdalic
Copy link
Author

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.

@languitar
Copy link
Owner

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?

@Flowdalic
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants