Bug 186279 - kwin consumes 60-70% CPU when showing a busy cursor in applications
Summary: kwin consumes 60-70% CPU when showing a busy cursor in applications
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: investigated, triaged
Depends on:
Blocks:
 
Reported: 2009-03-06 00:06 UTC by devsk
Modified: 2018-10-27 02:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
strace -tt when busy page loading in firefox during the whole run (627.04 KB, application/bzip2)
2009-03-06 00:10 UTC, devsk
Details
strace -tt when busy page loading in firefox in xrender mode (270.56 KB, application/bzip2)
2009-03-06 00:11 UTC, devsk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2009-03-06 00:06:15 UTC
Version:           4.2.1 (using KDE 4.2.0)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    Gentoo Packages

kwin starts to consume 60-70% of CPU when a page is loaded in firefox and page takes time to load. It is same with other applications as well. When they are loading and need to show some animated cursor, or progress bar, the CPU usage of kwin goes up.

The twist is that this happens only in opengl mode. And not in xrender mode. Xrender mode is extremely slow though, so its not usable. I duly took the strace of kwin in both cases and found some differences which may help you resolve this. It seems like in opengl mode, kwin is calling sched_yield in quick succession while in xrender mode, it doesn't. Also, xrender mode immediately brings down the idle CPU usage of kwin to 0-3% range, whereas in opengl mode, I see around 6-10% CPU usage when nothing is happening in the system.

I have nvidia 6600GT and I am using new stable 180.29 driver.
Comment 1 devsk 2009-03-06 00:10:51 UTC
Created attachment 31812 [details]
strace -tt when busy page loading in firefox during the whole run
Comment 2 devsk 2009-03-06 00:11:43 UTC
Created attachment 31813 [details]
strace -tt when busy page loading in firefox in xrender mode
Comment 3 Anton Petrusevich 2009-09-30 20:54:42 UTC
I have this bug also.

 strace -c -p 6623                                                                                                                                                                                                                            
Process 6623 attached - interrupt to quit                                                                                                                                                                                                                                      
^CProcess 6623 detached                                                                                                                                                                                                                                                        
% time     seconds  usecs/call     calls    errors syscall                                                                                                                                                                                                                     
------ ----------- ----------- --------- --------- ----------------                                                                                                                                                                                                            
 78.28    0.003013           1      2335           poll                                                                                                                                                                                                                        
 15.33    0.000590           0     61359           sched_yield                                                                                                                                                                                                                 
  3.74    0.000144           1       160           writev                                                                                                                                                                                                                      
  1.58    0.000061           0      4343      4258 read                                                                                                                                                                                                                        
  1.07    0.000041           0       237           ioctl                                                                                                                                                                                                                       
  0.00    0.000000           0       708           stat                                                                                                                                                                                                                        
  0.00    0.000000           0        79           getpid                                                                                                                                                                                                                      
------ ----------- ----------- --------- --------- ----------------                                                                                                                                                                                                            
100.00    0.003849                 69221      4258 total                 

OpenGL, "Texture From Pixmap".

kernel: 2.6.31.1 SMP PREEMPT x86_64

NVIDIA 185.18.36
Comment 4 Michael Leupold 2010-10-10 18:43:15 UTC
I can't reproduce this bug on svn trunk r1184315 using an NVIDIA GeForce 8600 GTS with 256.35 driver. Can you reproduce using a recent KDE (4.5) and a recent nvidia driver?
Comment 5 Ortwin Glück 2011-09-21 13:37:01 UTC
You are asking to reproduce it. Here you go:
This occurs when jvisualvm (from Sun JDK) displays the progress bar when analyzing a heap dump (which takes several hours).

$ strace -p 3044 -c
Process 3044 attached - interrupt to quit
^CProcess 3044 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 53.59    0.000261           0     23310           sched_yield
 25.87    0.000126           0       924       661 read
 16.02    0.000078           0       258           ioctl
  4.52    0.000022           0       691           stat
  0.00    0.000000           0        87           open

kwin-4.6.5
01:00.0 VGA compatible controller: nVidia Corporation GT215 [Quadro FX 1800M] (rev a2)
mesa-7.11
nvidia-drivers-275.09.07
xorg-server-1.10.4
Comment 6 Thomas Lübking 2011-09-22 19:46:09 UTC
What's a "Sun JDK"?  :-P
         ^^^^^

If you'd activate the "Show Paint" plugin while doing so, does this region or the entire window flicker like crazy? (the cause is -given the comments- very likely the gl_texture_from_pixmap routine)
Comment 7 Thomas Lübking 2012-03-11 19:09:54 UTC
I fear this could be related to the nvidia hack (which hardcodes a __gl_yield=nothing env)

In case you can (still) reproduce this, please try "KWIN_NVIDIA_HACK=0 kwin --replace&"
Comment 8 Andrew Crouthamel 2018-09-22 01:58:14 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Andrew Crouthamel 2018-10-27 02:35:53 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!