]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cooker/server: Fix up 100% CPU usage at idle
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 10 Mar 2015 10:29:46 +0000 (10:29 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 10 Mar 2015 10:37:07 +0000 (10:37 +0000)
The recent inotify changes are causing a 100% cpu usage issue in the
idle handlers. To avoid this, we update the idle functions to optionally
report a float value which is the delay before the function needs to be
called again. 1 second is fine for the inotify handler, in reality its
more like 0.1s due to the default idle function sleep.

This reverts performance regressions of 1.5 minutes on a kernel build
and ~5-6 minutes on a image from scratch.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/cooker.py
lib/bb/server/process.py
lib/bb/server/xmlrpc.py

index 57fb58157e3f5dc6ab4a26f65662a1e20a4c6565..2176167eb794d6e71873196eaa3fd2c1135bea0b 100644 (file)
@@ -142,7 +142,7 @@ class BBCooker:
                     # read notified events and enqeue them
                     n.read_events()
                     n.process_events()
-            return True
+            return 1.0
 
         self.configuration.server_register_idlecallback(_process_inotify_updates, [self.confignotifier, self.notifier])
 
index 7671b26a80cb81872db977fb91dce25784294636..c9286ddba724306ef45d0a3c07fe7636646c16b1 100644 (file)
@@ -135,6 +135,9 @@ class ProcessServer(Process, BaseImplServer):
                     nextsleep = None
                 elif retval is True:
                     nextsleep = None
+                elif isinstance(retval, float):
+                    if (retval < nextsleep):
+                        nextsleep = retval
                 elif nextsleep is None:
                     continue
                 else:
index 17f3d9d9063ccc1727fc96200770e5dc3aa40baf..75ec8556f48e5579cdcd820dc8409e4b78944baa 100644 (file)
@@ -242,6 +242,9 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
                         del self._idlefuns[function]
                     elif retval is True:
                         nextsleep = 0
+                    elif isinstance(retval, float):
+                        if (retval < nextsleep):
+                            nextsleep = retval
                     else:
                         fds = fds + retval
                 except SystemExit: