aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2021-08-18 21:29:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-19 10:15:07 +0100
commitc459053897a9c0b588c999331f9b5fcc074d0781 (patch)
tree10fd6a50d76be0c5d4b1fecf9815df9475044a64
parent8fe415004b228c108dd20d1163edbe4b7722a01a (diff)
downloadopenembedded-core-contrib-c459053897a9c0b588c999331f9b5fcc074d0781.tar.gz
openembedded-core-contrib-c459053897a9c0b588c999331f9b5fcc074d0781.tar.bz2
openembedded-core-contrib-c459053897a9c0b588c999331f9b5fcc074d0781.zip
sstate.bbclass: get the number of threads from BB_NUMBER_THREADS
- bitbake BB_NUMBER_THREADS uses cpu_count from oe utils that uses the python os.sched_getaffinity and it is more acurrate. grep -nH ^BB_NUMBER_THREADS meta/conf/bitbake.conf meta/conf/bitbake.conf:806:BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()}" - multiprocessing.cpu_count() returns the number of CPUs on the host, not the number of usable CPUs on the host. If the user is using scheduler affinity then the number of usable CPUs may be less, so when determining how many cores we can use check the affinity instead. Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass5
1 files changed, 2 insertions, 3 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 2175ace4c40..d7f1b3f26ed 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -971,13 +971,12 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
tasklist.append((tid, sstatefile))
if tasklist:
+ nproc = min(int(d.getVar("BB_NUMBER_THREADS")), len(tasklist))
+
if len(tasklist) >= min_tasks:
msg = "Checking sstate mirror object availability"
bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
- import multiprocessing
- nproc = min(multiprocessing.cpu_count(), len(tasklist))
-
bb.event.enable_threadlock()
pool = oe.utils.ThreadedPool(nproc, len(tasklist),
worker_init=checkstatus_init, worker_end=checkstatus_end)