From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Alexander Kanavin <alex.kanavin@gmail.com>,
Khem Raj <raj.khem@gmail.com>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [bitbake-devel] regression of 'world' performance?
Date: Fri, 09 Feb 2024 15:43:44 +0000 [thread overview]
Message-ID: <947006112712dcca07c607eb6b49b7e4e475c3d9.camel@linuxfoundation.org> (raw)
In-Reply-To: <CANNYZj_r2S7b+3r4CEz8cGZSqT_wa785p1BtpZxb60CVvZJcAg@mail.gmail.com>
On Fri, 2024-02-09 at 16:23 +0100, Alexander Kanavin wrote:
> > I have observed something similar and brought it up in last dev call as well
> > one suggestion was to disable hash equivalence, which I did, it does not change
> > a lot which could be attributed to hash equivalence or otherwise, I have also
> > tried different python versions on the host but that did not change
> > anything either.
> > I am still looking for more ways to narrow it down.
>
> I finally got to look at this, and yes I think there is a nasty
> quadratic growth in bitbake. Details:
>
> 1. How to reproduce: set up a plain build with empty sstate and
> default config, enabling meta-oe layers:
>
> BBLAYERS ?= " \
> /srv/work/alex/poky/meta \
> /srv/work/alex/poky/meta-poky \
> /srv/work/alex/poky/meta-yocto-bsp \
> /srv/work/alex/meta-openembedded/meta-oe \
> /srv/work/alex/meta-openembedded/meta-python \
> /srv/work/alex/meta-openembedded/meta-networking \
> /srv/work/alex/meta-openembedded/meta-filesystems \
> /srv/work/alex/meta-openembedded/meta-gnome \
> /srv/work/alex/meta-openembedded/meta-xfce \
> /srv/work/alex/meta-openembedded/meta-multimedia \
> "
>
> Then run 'bitbake world'. No tasks are going to start for minutes and
> minutes and minutes: it will seemingly remain stuck at
> NOTE: Executing Tasks
>
> 2. What is happening? After adding some debugging to
> bitbake/lib/bb/runqueue.py, I found:
>
> RunQueueExecute's execute() is being called over and over and over,
> thousands of times. Each new call into it is slower than the next. No
> tasks are actually run.
>
> execute() contains this loop:
>
> for nexttask in self.sorted_setscene_tids:
>
> self.sorted_setscene_tids contains about 28000 entries in each
> execution of the loop.
>
> Every time the loop is executed, it iterates over those 28000 entries,
> stopping one item further along in that list, in this block of code:
>
> if nexttask in self.sqdata.outrightfail:
> logger.debug2('No package found, so skipping
> setscene task %s', nexttask)
> self.sq_task_failoutright(nexttask)
> return True
>
> Then the loop restarts from the beginning, etc. Until it reaches the
> end of self.sorted_setscene_tids. In the process, items in the list
> are checked 28000^2-ish times (1+2+...+28000), before anything even
> starts.
>
> 3. What to do?
>
> Of course I have no idea what I'm doing; this code is extremely
> delicate :) Nevertheless, I replaced 'return True' in that block with
> 'continue', with massive improvement to when tasks actually start
> running (after printing 'NOTE: Executing Tasks') and no obvious
> immediate fails.
>
> Before the change it was still stuck in that loop after 60 minutes
> (!), and after the change it proceeded to the tasks after just two
> minutes (!).
>
> There are other 'return True's inside that loop that could also be
> contributing to quadratic behaviour, I didn't check those.
>
> Hopefully this helps.
There is effectively a "main loop" within bitbake, so execute() is
meant to do one thing, then return, on the assumption it will get
called straight back.
Since the "continue" makes it faster, it suggests something else
somewhere is being slow and as you mention, there are a load of other
code paths which could also have a similar issue.
Could you find out where the actual delay is, since it should just hget
a call straight back. Or is it the loop iteration itself which is slow?
Even with 20k entries, you'd think python would handle that.
Finally, I'd also mention the -P option to bitbake, then having a look
at the various profile*.log files. One of them should be for cooker and
should clearly show where it is spending the time.
Cheers,
Richard
next prev parent reply other threads:[~2024-02-09 15:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 10:57 regression of 'world' performance? Alexander Kanavin
2024-01-12 12:13 ` [bitbake-devel] " Richard Purdie
2024-01-12 12:27 ` Alexander Kanavin
2024-01-12 22:19 ` Khem Raj
2024-02-09 15:23 ` Alexander Kanavin
2024-02-09 15:43 ` Richard Purdie [this message]
2024-02-09 15:59 ` Alexander Kanavin
2024-02-09 16:05 ` Richard Purdie
2024-02-09 16:16 ` Alexander Kanavin
2024-02-09 16:22 ` Richard Purdie
2024-02-09 17:02 ` Alexander Kanavin
[not found] ` <17B24084174823DE.15017@lists.openembedded.org>
2024-02-09 20:44 ` Alexander Kanavin
2024-02-09 21:43 ` chris.laplante
2024-02-09 22:50 ` chris.laplante
2024-02-09 23:33 ` Richard Purdie
[not found] ` <17B255DB2CE33879.588@lists.openembedded.org>
2024-02-09 23:59 ` Richard Purdie
[not found] ` <17B257441406400D.588@lists.openembedded.org>
2024-02-10 15:16 ` Richard Purdie
[not found] ` <17B2894C95E031D0.14481@lists.openembedded.org>
2024-02-10 20:42 ` Richard Purdie
[not found] ` <17B29B2072FF51A8.14481@lists.openembedded.org>
2024-02-10 20:52 ` Richard Purdie
2024-02-12 12:58 ` Alexander Kanavin
2024-02-13 8:57 ` Richard Purdie
2024-02-13 9:42 ` Alexander Kanavin
2024-02-13 12:41 ` Richard Purdie
2024-02-14 6:59 ` Alexander Kanavin
2024-02-14 8:05 ` Richard Purdie
2024-02-13 10:49 ` Ross Burton
2024-02-13 12:31 ` 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=947006112712dcca07c607eb6b49b7e4e475c3d9.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=alex.kanavin@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=raj.khem@gmail.com \
/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.