All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ola x Nilsson <ola.x.nilsson@axis.com>
To: Randy MacLeod <randy.macleod@windriver.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
	"Zheng.qiu@uwaterloo.ca" <Zheng.qiu@uwaterloo.ca>,
	<bitbake-devel@lists.openembedded.org>
Subject: Re: [bitbake-devel] Bitbake PSI checker
Date: Mon, 19 Dec 2022 13:50:47 +0100	[thread overview]
Message-ID: <jwqfsdbo6w9.fsf@axis.com> (raw)
In-Reply-To: <49ffc1db-9b43-e570-d726-dba12d560a30@windriver.com>


On Mon, Dec 12 2022, Randy MacLeod wrote:

> CCing Richard
>
> On 2022-12-12 05:07, Ola x Nilsson via lists.openembedded.org wrote:
>> Hi,
>>
>> I've been looking into using the pressure stall information awareness of
>> bitbake
> That's good to hear Ola.
>>   but I have some problems getting it to work.  Actually I think
>> it just doesn't work at all.
>
> Doesn't work at all?
>
> Well that would be surprising. See below.

OK, it will occasionally block a task. But since the next attempt will
always be a very short time interval it will almost always start a new
task even if the pressure is high.
At least this is what I observe on my system.

<snip>

> 1. Rather than just keep track of the previous pressure values
> seen more than 1 second ago as done currently:
>
>        if now - self.prev_pressure_time > 1.0:
>
> and always using that as a reference, we can
> store say 10 values per second and use that as a reference.
>
> There are some challenges in that approach in that we don't control
> how often the function is called. Averaging over the last 10 calls
> is tempting but likely has some edge cases such as when there are
> lots of tasks starting/ending.
>
>
> 2. If there has been a long delay since the function was last called,
> we could check the pressure, sleep for a short period of time and check it
> again. Some people would not like this since it will needlessly delay 
> the build
> so we'd have to keep the delay to < 1 second. Too short a delay will reduce
> the accuracy of the result but I suspect that 0.1 seconds is sufficient 
> for most
> users. We could also look at the avg10 value in this case or even some 
> combination of
> both the current contention and avg10.
>
>
> 3. Just calculate the pressure per second by:
>
>     ( current pressure - last pressure ) / (now - last_time)
>
> This could handle  short time differences such os milliseconds
> as would be a 'cheap' way to deal with long delays. In your case,
> the pressure would be:
>
>    978077.0 io_pressure 1353882.0 mem_pressure 20922.0
>
> divided by ~19 since the initial values were close to zero.
>
> Then for the next time, just 0.1 seconds later:
>
> 1670840042.384582 cpu_pressure 8978077.0 io_pressure 1353882.0 mem_pressure 20922.0
> 1670840042.384582 cpu io  pressure exceeded over 18.677629 seconds
> 1670840042.486946 cpu_pressure 466.0 io_pressure 30792.0 mem_pressure 0.0
>
> Multiplying by 10 or easy calculation, the would be a pressure:
>
> cpu: 4660, io: 307920, mem: 0.
>
>
> Do you have another idea or a preference as to which approach we take?

I think 3 is a good first step.  Using multiple samples could improve
our calculated "avg1", but lets do that later if needed.

/Ola

>
> ../Randy
>
>
>>
>> /Ola Nilsson
>>
>> 
>>



  reply	other threads:[~2022-12-19 13:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 10:07 Bitbake PSI checker Ola x Nilsson
2022-12-12 20:48 ` [bitbake-devel] " Randy MacLeod
2022-12-19 12:50   ` Ola x Nilsson [this message]
2022-12-19 19:49     ` contrib
2023-05-20 19:58       ` Randy MacLeod
2023-05-22  2:17         ` ChenQi
2023-05-22  9:36           ` Ola x Nilsson
2023-05-22 14:41             ` Randy MacLeod
2023-05-23  2:08               ` Chen, Qi

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=jwqfsdbo6w9.fsf@axis.com \
    --to=ola.x.nilsson@axis.com \
    --cc=Zheng.qiu@uwaterloo.ca \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=randy.macleod@windriver.com \
    --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 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.