All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] build: Add BB_TASK_NICE_LEVEL to task code
@ 2013-09-20 10:29 Richard Purdie
  2013-09-20 11:09 ` Paul Eggleton
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2013-09-20 10:29 UTC (permalink / raw)
  To: bitbake-devel

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>
---
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 8aec699..9addd71 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -346,6 +346,13 @@ 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
+        logger.debug(1, "Renice to %s " % os.nice(nice))
+
     bb.utils.mkdirhier(tempdir)
 
     # Determine the logfile to generate




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-20 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 10:29 [PATCH] build: Add BB_TASK_NICE_LEVEL to task code Richard Purdie
2013-09-20 11:09 ` Paul Eggleton
2013-09-20 11:59   ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.