]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
build: Add BB_TASK_NICE_LEVEL to task code
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 20 Sep 2013 09:54:40 +0000 (09:54 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 22 Sep 2013 11:16:31 +0000 (12:16 +0100)
On Linux its not possible for processes to regain a previous nice level after
it has changed. Its therefore not possible to have a core low priority and
then raise the priorities of individual tasks.

This variable allows us to do something like:

BB_TASK_NICE_LEVEL = "5"
BB_TASK_NICE_LEVEL_task-testimage = "0"

to give priority to specific tasks which the BB_NICE_LEVEL functionality
doesn't give us the option of.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/build.py

index 8aec699e79ac4343bdb89564e48ca93186ddc190..2e49a0936546538e24ecc334c8b94702ae085f14 100644 (file)
@@ -346,6 +346,14 @@ def _exec_task(fn, task, d, quieterr):
     if not tempdir:
         bb.fatal("T variable not set, unable to build")
 
+    # Change nice level if we're asked to
+    nice = localdata.getVar("BB_TASK_NICE_LEVEL", True)
+    if nice:
+        curnice = os.nice(0)
+        nice = int(nice) - curnice
+        newnice = os.nice(nice)
+        logger.debug(1, "Renice to %s " % newnice)
+
     bb.utils.mkdirhier(tempdir)
 
     # Determine the logfile to generate