diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2023-08-08 16:50:54 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-11 17:00:40 +0100 |
commit | 653ff4d85cbaf53627f7978b06c1f025ac4694e2 (patch) | |
tree | 73796c477441fd0a2fc416d8026c4b40639407f3 /bitbake | |
parent | ac5512b0acf3457a4c459d4d1711649053f4e618 (diff) | |
download | poky-653ff4d85cbaf53627f7978b06c1f025ac4694e2.tar.gz |
bitbake: runqueue.py: fix PSI check logic
The current calculation is not correct because if tdiff is less than
1.0, it's not taken into consideration when calculating the current
pressure.
Also, make it clear that the 1.0s is the psi accumulation cycle,
which might be changed in the future. We have this cycle because it
could largely avoid the 0 result issue, that is, if the interval
between checks are too small, the result might be 0. With this
accumulation logic, which has been there but let's make it clear,
this 0 result problem could be mitigated.
(Bitbake rev: 95fa8fb5fb4d5a72e79b11d69792613bfd494e72)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 48788f4aa6..17da1bc1a5 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -200,7 +200,8 @@ class RunQueueScheduler(object): | |||
200 | curr_memory_pressure = memory_pressure_fds.readline().split()[4].split("=")[1] | 200 | curr_memory_pressure = memory_pressure_fds.readline().split()[4].split("=")[1] |
201 | now = time.time() | 201 | now = time.time() |
202 | tdiff = now - self.prev_pressure_time | 202 | tdiff = now - self.prev_pressure_time |
203 | if tdiff > 1.0: | 203 | psi_accumulation_interval = 1.0 |
204 | if tdiff > psi_accumulation_interval: | ||
204 | exceeds_cpu_pressure = self.rq.max_cpu_pressure and (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) / tdiff > self.rq.max_cpu_pressure | 205 | exceeds_cpu_pressure = self.rq.max_cpu_pressure and (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) / tdiff > self.rq.max_cpu_pressure |
205 | exceeds_io_pressure = self.rq.max_io_pressure and (float(curr_io_pressure) - float(self.prev_io_pressure)) / tdiff > self.rq.max_io_pressure | 206 | exceeds_io_pressure = self.rq.max_io_pressure and (float(curr_io_pressure) - float(self.prev_io_pressure)) / tdiff > self.rq.max_io_pressure |
206 | exceeds_memory_pressure = self.rq.max_memory_pressure and (float(curr_memory_pressure) - float(self.prev_memory_pressure)) / tdiff > self.rq.max_memory_pressure | 207 | exceeds_memory_pressure = self.rq.max_memory_pressure and (float(curr_memory_pressure) - float(self.prev_memory_pressure)) / tdiff > self.rq.max_memory_pressure |
@@ -209,9 +210,9 @@ class RunQueueScheduler(object): | |||
209 | self.prev_memory_pressure = curr_memory_pressure | 210 | self.prev_memory_pressure = curr_memory_pressure |
210 | self.prev_pressure_time = now | 211 | self.prev_pressure_time = now |
211 | else: | 212 | else: |
212 | exceeds_cpu_pressure = self.rq.max_cpu_pressure and (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) > self.rq.max_cpu_pressure | 213 | exceeds_cpu_pressure = self.rq.max_cpu_pressure and (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) / tdiff > self.rq.max_cpu_pressure |
213 | exceeds_io_pressure = self.rq.max_io_pressure and (float(curr_io_pressure) - float(self.prev_io_pressure)) > self.rq.max_io_pressure | 214 | exceeds_io_pressure = self.rq.max_io_pressure and (float(curr_io_pressure) - float(self.prev_io_pressure)) / tdiff > self.rq.max_io_pressure |
214 | exceeds_memory_pressure = self.rq.max_memory_pressure and (float(curr_memory_pressure) - float(self.prev_memory_pressure)) > self.rq.max_memory_pressure | 215 | exceeds_memory_pressure = self.rq.max_memory_pressure and (float(curr_memory_pressure) - float(self.prev_memory_pressure)) / tdiff > self.rq.max_memory_pressure |
215 | pressure_state = (exceeds_cpu_pressure, exceeds_io_pressure, exceeds_memory_pressure) | 216 | pressure_state = (exceeds_cpu_pressure, exceeds_io_pressure, exceeds_memory_pressure) |
216 | if hasattr(self, "pressure_state") and pressure_state != self.pressure_state: | 217 | if hasattr(self, "pressure_state") and pressure_state != self.pressure_state: |
217 | bb.note("Pressure status changed to CPU: %s, IO: %s, Mem: %s" % pressure_state) | 218 | bb.note("Pressure status changed to CPU: %s, IO: %s, Mem: %s" % pressure_state) |