summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/build.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-24 11:19:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-29 07:35:52 +0000
commit290534d3ff53b3c0a50e480863474d1785088c5a (patch)
tree011b9a73cbcf7c40fa6807716377a6355d408337 /bitbake/lib/bb/build.py
parent3ebf7617d6c869f798807792918e1030b3ab66de (diff)
downloadpoky-290534d3ff53b3c0a50e480863474d1785088c5a.tar.gz
bitbake: build/utils: Add BB_TASK_IONICE_LEVEL support
Similarly to BB_TASK_NICE_LEVEL, add BB_TASK_IONICE_LEVEL which allows the ioprio of tasks to be adjusted. This is in response to various qemu runtime timeouts which have been witnessed on the autobuilder, seemingly due to IO starvation (we already use NICE_LEVEL to adjust tasks). This has a fairly urgent need to deal with certain 'random' failures we're seeing on the autobuilders in testing. The format of the data in the variable is BB_TASK_IONICE_LEVEL = "<class>.<prio>". For <class>, 2 is best effort (the default), 1 is real time and 3 is idle. You'd need superuser privileges to use realtime. The <prio> value is a default of 4, and can be set between 0 and 7 with 7 being lowest priority and 0 the highest. The user can set this freely with normal privileges Note that in order for this to take effect, you need the cfq scheduler selected for the backing block device. We could use nice wrapper functions for ioprio from modules like psutil however that would complicate bitbake dependencies. This version has some magic numbers but works on the main 32 and 64 bit x86 build architectures and can easily be extended if ever needed. When we move to python 3.x, we can likely replace this with standard calls. (Bitbake rev: b9471ad147b102c45d65f5ffd9521864df7ff9c1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r--bitbake/lib/bb/build.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 948c3951f4..22428a649c 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -413,6 +413,13 @@ def _exec_task(fn, task, d, quieterr):
413 nice = int(nice) - curnice 413 nice = int(nice) - curnice
414 newnice = os.nice(nice) 414 newnice = os.nice(nice)
415 logger.debug(1, "Renice to %s " % newnice) 415 logger.debug(1, "Renice to %s " % newnice)
416 ionice = localdata.getVar("BB_TASK_IONICE_LEVEL", True)
417 if ionice:
418 try:
419 cls, prio = ionice.split(".", 1)
420 bb.utils.ioprio_set(os.getpid(), int(cls), int(prio))
421 except:
422 bb.warn("Invalid ionice level %s" % ionice)
416 423
417 bb.utils.mkdirhier(tempdir) 424 bb.utils.mkdirhier(tempdir)
418 425