summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 12:04:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 12:24:32 +0000
commit9375349e27b08b4d1cfe4825c042d4c82120e00b (patch)
tree10d6bb8a9302be30e7b8df72069c8278fdaaf5cd /bin
parent1679188f9c55c615cae780f2b5e6852dea9cf2ec (diff)
downloadbitbake-contrib-9375349e27b08b4d1cfe4825c042d4c82120e00b.zip
bitbake-contrib-9375349e27b08b4d1cfe4825c042d4c82120e00b.tar.gz
bitbake-contrib-9375349e27b08b4d1cfe4825c042d4c82120e00b.tar.bz2
bitbake-worker: Further IO performance tweaks
Looking further at the CPU loads on systems running large numbers of tasks, the following things helps performance: * Loop on waitpid until there are no processes still waiting * Using select to wait for the cooker pipe to be writable before writing avoiding pointless 100% cpu usage * Only reading from worker pipes that select highlights are readable Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-worker13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 10de54c..97b32c3 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -95,6 +95,7 @@ def worker_flush(worker_queue):
pass
while (worker_queue_int or not worker_queue.empty()):
try:
+ (_, ready, _) = select.select([], [worker_pipe], [], 1)
if not worker_queue.empty():
worker_queue_int = worker_queue_int + worker_queue.get()
written = os.write(worker_pipe, worker_queue_int)
@@ -369,9 +370,11 @@ class BitbakeWorker(object):
self.handle_item(b"quit", self.handle_quit)
for pipe in self.build_pipes:
- self.build_pipes[pipe].read()
+ if self.build_pipes[pipe].input in ready:
+ self.build_pipes[pipe].read()
if len(self.build_pids):
- self.process_waitpid()
+ while self.process_waitpid():
+ continue
def handle_item(self, item, func):
@@ -426,9 +429,9 @@ class BitbakeWorker(object):
try:
pid, status = os.waitpid(-1, os.WNOHANG)
if pid == 0 or os.WIFSTOPPED(status):
- return None
+ return False
except OSError:
- return None
+ return False
workerlog_write("Exit code of %s for pid %s\n" % (status, pid))
@@ -447,6 +450,8 @@ class BitbakeWorker(object):
worker_fire_prepickled(b"<exitcode>" + pickle.dumps((task, status)) + b"</exitcode>")
+ return True
+
def handle_finishnow(self, _):
if self.build_pids:
logger.info("Sending SIGTERM to remaining %s tasks", len(self.build_pids))