summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-12 23:08:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-13 13:52:10 +0000
commitcdb1cb2ed8f689a0a7ecc874885c0ba7c708cbd6 (patch)
treedc8d8bec4e27b2196dbfd6f810e1bb62021c29d7 /bitbake/lib/bb/runqueue.py
parent71f55957f074818d782971a0b678a77d330597d3 (diff)
downloadpoky-cdb1cb2ed8f689a0a7ecc874885c0ba7c708cbd6.tar.gz
bitbake: runqueue: Improve setcene performance when encoutering many 'hard' dependencies
"bitbake world -n --setscene-only" shows poor performance as the numbers of tasks increases. Analysys shows this is due to the "deferred" hard dependencies being repeatedly processed which doesn't allow much forward progress in overall task execution. To avoid this, mark when it has been done and don't reprocess until dependencies are updated. We have to be careful as we've seen bugs where these dependencies aren't processed at the right time. They also have to be reproceseed during task migration/rehashing so the code has to "self heal" the data structures. (Bitbake rev: e5609bac06c17dabcf6286b47b1a3f19f5a1160f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r--bitbake/lib/bb/runqueue.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 95cab5132f..e86ccd8c61 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1840,6 +1840,7 @@ class RunQueueExecute:
1840 self.failed_tids = [] 1840 self.failed_tids = []
1841 self.sq_deferred = {} 1841 self.sq_deferred = {}
1842 self.sq_needed_harddeps = set() 1842 self.sq_needed_harddeps = set()
1843 self.sq_harddep_deferred = set()
1843 1844
1844 self.stampcache = {} 1845 self.stampcache = {}
1845 1846
@@ -2163,7 +2164,7 @@ class RunQueueExecute:
2163 if not self.sqdone and self.can_start_task(): 2164 if not self.sqdone and self.can_start_task():
2164 # Find the next setscene to run 2165 # Find the next setscene to run
2165 for nexttask in self.sorted_setscene_tids: 2166 for nexttask in self.sorted_setscene_tids:
2166 if nexttask in self.sq_buildable and nexttask not in self.sq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values(): 2167 if nexttask in self.sq_buildable and nexttask not in self.sq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values() and nexttask not in self.sq_harddep_deferred:
2167 if nexttask not in self.sqdata.unskippable and self.sqdata.sq_revdeps[nexttask] and \ 2168 if nexttask not in self.sqdata.unskippable and self.sqdata.sq_revdeps[nexttask] and \
2168 nexttask not in self.sq_needed_harddeps and \ 2169 nexttask not in self.sq_needed_harddeps and \
2169 self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and \ 2170 self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and \
@@ -2184,6 +2185,7 @@ class RunQueueExecute:
2184 self.sq_buildable.add(dep) 2185 self.sq_buildable.add(dep)
2185 self.sq_needed_harddeps.add(dep) 2186 self.sq_needed_harddeps.add(dep)
2186 updated = True 2187 updated = True
2188 self.sq_harddep_deferred.add(nexttask)
2187 if updated: 2189 if updated:
2188 return True 2190 return True
2189 continue 2191 continue
@@ -2678,6 +2680,7 @@ class RunQueueExecute:
2678 if changed: 2680 if changed:
2679 self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered)) 2681 self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered))
2680 self.sq_needed_harddeps = set() 2682 self.sq_needed_harddeps = set()
2683 self.sq_harddep_deferred = set()
2681 self.holdoff_need_update = True 2684 self.holdoff_need_update = True
2682 2685
2683 def scenequeue_updatecounters(self, task, fail=False): 2686 def scenequeue_updatecounters(self, task, fail=False):
@@ -2712,6 +2715,13 @@ class RunQueueExecute:
2712 new.add(dep) 2715 new.add(dep)
2713 next = new 2716 next = new
2714 2717
2718 # If this task was one which other setscene tasks have a hard dependency upon, we need
2719 # to walk through the hard dependencies and allow execution of those which have completed dependencies.
2720 if task in self.sqdata.sq_harddeps:
2721 for dep in self.sq_harddep_deferred.copy():
2722 if self.sqdata.sq_harddeps_rev[dep].issubset(self.scenequeue_covered | self.scenequeue_notcovered):
2723 self.sq_harddep_deferred.remove(dep)
2724
2715 self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered)) 2725 self.stats.updateCovered(len(self.scenequeue_covered), len(self.scenequeue_notcovered))
2716 self.holdoff_need_update = True 2726 self.holdoff_need_update = True
2717 2727