summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-11-20 10:37:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-11-21 12:16:28 +0000
commitf95a645dd4fbb98afe6f10cd28d5908bbe845fbc (patch)
treeecf3a5a09c272de5bce44efb28622ac00d2c3f79 /bitbake
parentb97de63d2feaeb7710b7550dfc4144f41f5c8fc6 (diff)
downloadpoky-f95a645dd4fbb98afe6f10cd28d5908bbe845fbc.tar.gz
bitbake: bitbake-worker/cooker: Increase default pipe size
The default pipe size is 64kb on builds, which can be inefficient for larger log files from workers. Increase the pipe size to 512kb since build systems have decent amounts of memory and this is a more efficient way of batching the data. Tweak the default read sizes to match the pipe size for efficiency. Since the contstant is only present in python 3.10 onwards, add some compatibility code. (Bitbake rev: 69c14e46600ba5ae9703f67704ab2548875ae6d7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker14
-rw-r--r--bitbake/lib/bb/runqueue.py2
2 files changed, 13 insertions, 3 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index a8a9660c5f..88217182fb 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -21,9 +21,14 @@ import traceback
21import queue 21import queue
22import shlex 22import shlex
23import subprocess 23import subprocess
24import fcntl
24from multiprocessing import Lock 25from multiprocessing import Lock
25from threading import Thread 26from threading import Thread
26 27
28# Remove when we have a minimum of python 3.10
29if not hasattr(fcntl, 'F_SETPIPE_SZ'):
30 fcntl.F_SETPIPE_SZ = 1031
31
27bb.utils.check_system_locale() 32bb.utils.check_system_locale()
28 33
29# Users shouldn't be running this code directly 34# Users shouldn't be running this code directly
@@ -44,7 +49,6 @@ if sys.argv[1].startswith("decafbadbad"):
44# updates to log files for use with tail 49# updates to log files for use with tail
45try: 50try:
46 if sys.stdout.name == '<stdout>': 51 if sys.stdout.name == '<stdout>':
47 import fcntl
48 fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL) 52 fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL)
49 fl |= os.O_SYNC 53 fl |= os.O_SYNC
50 fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl) 54 fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl)
@@ -56,6 +60,12 @@ logger = logging.getLogger("BitBake")
56 60
57worker_pipe = sys.stdout.fileno() 61worker_pipe = sys.stdout.fileno()
58bb.utils.nonblockingfd(worker_pipe) 62bb.utils.nonblockingfd(worker_pipe)
63# Try to make the pipe buffers larger as it is much more efficient. If we can't
64# e.g. out of buffer space (/proc/sys/fs/pipe-user-pages-soft) then just pass over.
65try:
66 fcntl.fcntl(worker_pipe, fcntl.F_SETPIPE_SZ, 512 * 1024)
67except:
68 pass
59# Need to guard against multiprocessing being used in child processes 69# Need to guard against multiprocessing being used in child processes
60# and multiple processes trying to write to the parent at the same time 70# and multiple processes trying to write to the parent at the same time
61worker_pipe_lock = None 71worker_pipe_lock = None
@@ -357,7 +367,7 @@ class runQueueWorkerPipe():
357 def read(self): 367 def read(self):
358 start = len(self.queue) 368 start = len(self.queue)
359 try: 369 try:
360 self.queue.extend(self.input.read(102400) or b"") 370 self.queue.extend(self.input.read(512*1024) or b"")
361 except (OSError, IOError) as e: 371 except (OSError, IOError) as e:
362 if e.errno != errno.EAGAIN: 372 if e.errno != errno.EAGAIN:
363 raise 373 raise
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 1b5b58f352..61608ac603 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -3318,7 +3318,7 @@ class runQueuePipe():
3318 3318
3319 start = len(self.queue) 3319 start = len(self.queue)
3320 try: 3320 try:
3321 self.queue.extend(self.input.read(102400) or b"") 3321 self.queue.extend(self.input.read(512 * 1024) or b"")
3322 except (OSError, IOError) as e: 3322 except (OSError, IOError) as e:
3323 if e.errno != errno.EAGAIN: 3323 if e.errno != errno.EAGAIN:
3324 raise 3324 raise