Bug 149731 - kwrapper polls - causes 1 unnecessary wake-up (=interrupt) per second
Summary: kwrapper polls - causes 1 unnecessary wake-up (=interrupt) per second
Status: RESOLVED FIXED
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-10 16:45 UTC by Alan Jenkins
Modified: 2008-03-09 20:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
KInit 3.5.6 - send LAUNCHER_DIED messages to kwrapper as well as klauncher (4.39 KB, patch)
2007-09-11 11:21 UTC, Alan Jenkins
Details
kwrapper 3.5.6 - wait for LAUNCHER_DIED messages instead of polling (2.92 KB, patch)
2007-09-11 11:22 UTC, Alan Jenkins
Details
KInit 3.5.6 - send LAUNCHER_DIED messages to kwrapper as well as klauncher (4.41 KB, patch)
2007-09-11 12:16 UTC, Alan Jenkins
Details
kwrapper 3.5.6 - wait for LAUNCHER_DIED messages instead of polling (3.09 KB, patch)
2007-09-23 19:36 UTC, Alan Jenkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Jenkins 2007-09-10 16:45:43 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Unspecified Linux
OS:                Linux

Wakeups are bad[1].

Each instance of kwrapper wakes up once a second, to see whether the application it started has quit yet.  It checks the return value from kill(SIG_0).  It can't use wait() because the application is started by kdeinit on kwrappers behalf, so kdeinit should be modified to do it and send "application died" messages to the appropriate kwrapper instances so they don't have to poll.

In addition to helping bring down the number of wakeups on an idle system, kdeinit would be able to tell kwrapper what exit code the application terminated with.  So if you start a program with kwrapper which terminates abnormally, it might be easier to find out the reason.

[1] http://www.linuxpowertop.org/
Comment 1 Alan Jenkins 2007-09-11 11:21:32 UTC
Created attachment 21602 [details]
KInit 3.5.6 - send LAUNCHER_DIED messages to kwrapper as well as klauncher
Comment 2 Alan Jenkins 2007-09-11 11:22:24 UTC
Created attachment 21603 [details]
kwrapper 3.5.6 - wait for LAUNCHER_DIED messages instead of polling
Comment 3 Alan Jenkins 2007-09-11 11:27:12 UTC
Patches work for me, but I'm not a KDE developer - they could be in bad taste, break things I don't use, or be completely superceded by KDE 4.

Released under the same license as the files they apply to.
Comment 4 Alan Jenkins 2007-09-11 12:16:02 UTC
Created attachment 21604 [details]
KInit 3.5.6 - send LAUNCHER_DIED messages to kwrapper as well as klauncher

Um, well heres the version of the Kinit patch that works for the _right_
reasons.

(The previous one forgot to keep the socket alive to send the LAUNCHER_DIED
message.  I swear it actually worked; the only difference was kwrapper would
always return 255).
Comment 5 Arne Stäcker 2007-09-21 12:15:43 UTC
The kwrapper patch is for KDE 3.5.7 (gentoo) broken. I get:
wrapper.c: In function 'kwrapper_run':
wrapper.c:287: error: 'pid' redeclared as different kind of symbol
wrapper.c:283: error: previous definition of 'pid' was here
wrapper.c:283: warning: unused parameter 'pid'


Comment 6 Alan Jenkins 2007-09-23 19:34:40 UTC
I would have responded earlier but my hard drive died.

I get exactly the if I try to re-apply these patches.  I'm afraid I must have attached a broken kwrapper patch.  I've fixed the problem, built kwrapper and kdeinit, and I'm now using those binaries without any difficulties.
Comment 7 Alan Jenkins 2007-09-23 19:36:49 UTC
Created attachment 21674 [details]
kwrapper 3.5.6 - wait for LAUNCHER_DIED messages instead of polling

And heres the kwrapper patch that actually builds.

Sorry!
Comment 8 Arne Stäcker 2007-09-24 12:01:41 UTC
No need for a sorry.
Now it works. Thanks.
Comment 9 Lubos Lunak 2008-03-09 20:37:14 UTC
SVN commit 783850 by lunakl:

Change kdeinit to tell kwrapper about the exit status in order to stop
kwrapper from polling. Patch by Alan Jenkins <alan-jenkins@tuffmail.co.uk>.
BUG: 149731



 M  +72 -25    kinit.cpp  
 M  +41 -25    wrapper.c  


WebSVN link: http://websvn.kde.org/?view=rev&revision=783850
Comment 10 Lubos Lunak 2008-03-09 20:38:55 UTC
Thanks for the patch, I somehow missed it before. I've applied the patch for KDE4.1. I'm a bit hesistant to commit to for 3.5 because of the changes in the launching code and this shouldn't make that big difference for 3.5 anyway, with Kicker having so many timers.
Comment 11 Alan Jenkins 2008-03-09 20:55:22 UTC
Thanks! My experience of Kicker is that it averages one wakeup a second - the same as kwrapper is without this patch.

But I don't care enough about this issue in practise - I'm just happy it's been fixed in KDE4.  I certainly appreciate the maintenance argument.