Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] build: Add BB_TASK_NICE_LEVEL to task code
Date: Fri, 20 Sep 2013 12:09:39 +0100	[thread overview]
Message-ID: <3335435.nZ1M0MKWov@helios> (raw)
In-Reply-To: <1379672987.18603.139.camel@ted>

On Friday 20 September 2013 11:29:47 Richard Purdie wrote:
> 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))

It's a matter of style to be sure, but I think it's better not to have debug 
statements that do more than just printing debug output - could the latter be 
split onto two lines? Then it's easy to tell what's being done.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


  reply	other threads:[~2013-09-20 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 10:29 [PATCH] build: Add BB_TASK_NICE_LEVEL to task code Richard Purdie
2013-09-20 11:09 ` Paul Eggleton [this message]
2013-09-20 11:59   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3335435.nZ1M0MKWov@helios \
    --to=paul.eggleton@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox