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

CPU load increased to 95 % since commit b2220d27cf6e8858c2e83dad9d0c46f6c83c2349 #4865

Closed
2 tasks done
arjanoosting opened this issue Jun 6, 2024 · 6 comments · Fixed by #4880
Closed
2 tasks done

Comments

@arjanoosting
Copy link
Contributor

Issue description

Today I tried out git master to see the fix for #4811 and noticed that laptop fan continued to make noise.
I discovered some error messages in the log (#4864) and high cpu load with qtile continuously using 95% of an CPU in the htop output.

I git bisected this issue to commit b2220d2 which mentions removing an premature optimization. It seems the premature optimization was needed on my system

git bisect bad
b2220d2 is the first bad commit
commit b2220d2
Author: Jeroen Wijenbergh [email protected]
Date: Sun May 26 13:56:34 2024 +0200

Wayland {X,Xdg}Window: Remove all position checks in place

Previously I checked if border needs to change or the window needs to be repositioned,
instead of calling configure and setting sizes every time `place()` is called. However,
this has too many edge cases. Let's not do premature optimization here because it leads to issues
such as #4838

CHANGELOG | 3 ++-
libqtile/backend/wayland/xdgwindow.py | 34 ++++++----------------------------
libqtile/backend/wayland/xwindow.py | 22 ++--------------------
3 files changed, 10 insertions(+), 49 deletions(-)

Version

0.26.1.dev4+gb2220d27

Backend

Wayland (experimental)

Config

No response

Logs

No response

Required

  • I have searched past issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
@arjanoosting
Copy link
Contributor Author

After reverting that commit the CPU usage dropped and fluctuates between 3.9 and 25%

@jwijenbergh
Copy link
Contributor

jwijenbergh commented Jun 6, 2024

Interesting as we never did this optimization in 0.25.0. can you comment the clipping inside of the place methods?


And

@arjanoosting
Copy link
Contributor Author

Hi,

I just tried with commented clipping calls, but the CPU load is still high:

git diff
diff --git a/libqtile/backend/wayland/xdgwindow.py b/libqtile/backend/wayland/xdgwindow.py
index 9364f24f..1acc0537 100644
--- a/libqtile/backend/wayland/xdgwindow.py
+++ b/libqtile/backend/wayland/xdgwindow.py
@@ -281,7 +281,7 @@ class XdgWindow(Window[XdgSurface]):
self.container.node.set_position(x, y)
self.surface.set_size(width, height)
self.surface.set_bounds(width, height)

  •    self.clip()
    
  •    # self.clip()
    
       self.paint_borders(bordercolor, borderwidth)
    

diff --git a/libqtile/backend/wayland/xwindow.py b/libqtile/backend/wayland/xwindow.py
index bcc4697a..5502a110 100644
--- a/libqtile/backend/wayland/xwindow.py
+++ b/libqtile/backend/wayland/xwindow.py
@@ -349,7 +349,7 @@ class XWindow(Window[xwayland.Surface]):

     self.container.node.set_position(x, y)
     self.surface.configure(x, y, width, height)
  •    self.clip()
    
  •    # self.clip()
    
       self.paint_borders(bordercolor, borderwidth)
    

@elParaguayo
Copy link
Member

I haven't investigated further by I have seen similar behaviour. My CPU was 70-80%. Reverting that commit takes it down to 1-3%.

@arjanoosting
Copy link
Contributor Author

Issue is indeed fixed with #4880

@jwijenbergh
Copy link
Contributor

Issue is indeed fixed with #4880

Thanks for checking! Apologies for the issue

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

Successfully merging a pull request may close this issue.

4 participants