diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-04 17:47:44 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-06 17:39:55 +0000 |
commit | 9ece4a2e406509bd89dbce8dac80a02e600b0ecf (patch) | |
tree | dd5144cdee797e6e090393b19785c29f889d4ea4 | |
parent | d2a3f662b0eed900fc012a392bfa0a365df0df9b (diff) | |
download | bitbake-9ece4a2e406509bd89dbce8dac80a02e600b0ecf.tar.gz |
cooker: Rework the parsing results submission
The loop submitting the parser results was not efficient on many core systems
as may of the parsers could block for a long time waiting to send the results.
While a result was pending, the code wouldn't parse further jobs.
Change the code to parse further jobs even if the results can't be submitted
and lower the result submission timeout to keep the parsers busy.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/cooker.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 738849d18..1d347ddc5 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -2107,25 +2107,29 @@ class Parser(multiprocessing.Process): multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1) pending = [] + havejobs = True try: - while True: + while havejobs or pending: if self.quit.is_set(): break - if pending: - result = pending.pop() - else: - try: - job = self.jobs.pop() - except IndexError: - break + job = None + try: + job = self.jobs.pop() + except IndexError: + havejobs = False + if job: result = self.parse(*job) # Clear the siggen cache after parsing to control memory usage, its huge bb.parse.siggen.postparsing_clean_cache() - try: - self.results.put(result, timeout=0.25) - except queue.Full: pending.append(result) + + if pending: + try: + result = pending.pop() + self.results.put(result, timeout=0.05) + except queue.Full: + pending.append(result) finally: self.results.close() self.results.join_thread() |