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

Swayidle high CPU usage after pull request #3049 #3190

Closed
ghost opened this issue Nov 25, 2018 · 2 comments · Fixed by #3191
Closed

Swayidle high CPU usage after pull request #3049 #3190

ghost opened this issue Nov 25, 2018 · 2 comments · Fixed by #3191

Comments

@ghost
Copy link

ghost commented Nov 25, 2018

Swayidle sits at 100% CPU usage after a Sway session has been started.
The bug may have been introduced in d46d221.

@emersion
Copy link
Member

How do you start it? I don't have such issues.

@ghost
Copy link
Author

ghost commented Nov 25, 2018

I use an alias sway="export XKB_DEFAULT_LAYOUT=de && export QT_QPA_PLATFORM=wayland-egl && export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" && sway"

This is my Swayidle config:

exec swayidle \
        timeout 600 "brightnessctl --save --device=acpi_video0 && brightnessctl set 10% --device=acpi_video0" \
        resume 'brightnessctl --restore --device=acpi_video0' \
        timeout 3600 'swaymsg "output * dpms off"' \
        resume 'swaymsg "output * dpms on"' \

Edit:The same result with the default configuration.

emersion added a commit to emersion/sway that referenced this issue Nov 25, 2018
The wl_event_source_fd_update docs say:

> File descriptors are usually writable to begin with, so they do not need to
> be polled for writable until a write actually fails. When a write fails,
> the event mask can be changed to poll for readable and writable, delivering
> a dispatch callback when it is possible to write more. Once all data has
> been written, the mask can be changed to poll only for readable to avoid
> busy-looping on dispatch.

So we should only poll for WL_EVENT_WRITABLE if a write fails. I'm not yet sure
how to do this properly and Weston doesn't do it, so in the meantime I'll just
fix the busy loop. I'll ask them too.

Fixes swaywm#3190
ddevault pushed a commit to swaywm/swayidle that referenced this issue Jan 12, 2019
The wl_event_source_fd_update docs say:

> File descriptors are usually writable to begin with, so they do not need to
> be polled for writable until a write actually fails. When a write fails,
> the event mask can be changed to poll for readable and writable, delivering
> a dispatch callback when it is possible to write more. Once all data has
> been written, the mask can be changed to poll only for readable to avoid
> busy-looping on dispatch.

So we should only poll for WL_EVENT_WRITABLE if a write fails. I'm not yet sure
how to do this properly and Weston doesn't do it, so in the meantime I'll just
fix the busy loop. I'll ask them too.

Fixes swaywm/sway#3190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant