All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Improvements around BB_PRESSURE_* variables
@ 2025-04-11 14:46 Antonin Godard
  2025-04-11 14:46 ` [PATCH 1/2] runqueue: decrease the verbosity of pressure messages Antonin Godard
  2025-04-11 14:46 ` [PATCH 2/2] doc: bitbake-user-manual-ref-variables: improve BB_PRESSURE_* doc Antonin Godard
  0 siblings, 2 replies; 6+ messages in thread
From: Antonin Godard @ 2025-04-11 14:46 UTC (permalink / raw)
  To: bitbake-devel; +Cc: docs, Thomas Petazzoni, Antonin Godard

First patch makes the BB_PRESSURE_* variables not spam the log with
messages by default, unless -D is passed on the command line.

Second patch improves the documentation for these variables. The current
default value is really low and 15000 seems like a better default, at
least from my tests, it prevents too many tasks from being executed in
parallel.

Mention that these variables should be tweaked depending on the need.

This is a first step to providing better information on how to control
the resources used by bitbake. Later, this information could be reused
in a more general guide on how to do so - in fact, setting BB_PRESSURE_*
variables only do not impact how many threads a single task can use
(that would be done with PARALLEL_MAKE, probably).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
Antonin Godard (2):
      runqueue: decrease the verbosity of pressure messages
      doc: bitbake-user-manual-ref-variables: improve BB_PRESSURE_* doc

 .../bitbake-user-manual-ref-variables.rst          | 37 +++++++++++++++++++---
 lib/bb/runqueue.py                                 |  2 +-
 2 files changed, 33 insertions(+), 6 deletions(-)
---
base-commit: 874c607f475f3d60677d2720b80a28d0c2e963c6
change-id: 20250411-bb-pressure-improvements-51d9c5881fc1

Best regards,
--
Antonin Godard <antonin.godard@bootlin.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] runqueue: decrease the verbosity of pressure messages
  2025-04-11 14:46 [PATCH 0/2] Improvements around BB_PRESSURE_* variables Antonin Godard
@ 2025-04-11 14:46 ` Antonin Godard
  2025-04-11 19:09   ` [docs] " Martin Jansa
  2025-04-11 14:46 ` [PATCH 2/2] doc: bitbake-user-manual-ref-variables: improve BB_PRESSURE_* doc Antonin Godard
  1 sibling, 1 reply; 6+ messages in thread
From: Antonin Godard @ 2025-04-11 14:46 UTC (permalink / raw)
  To: bitbake-devel; +Cc: docs, Thomas Petazzoni, Antonin Godard

By default all the pressure changes are printed on the console and
generate a lot of spam to users using the BB_PRESSURE_* variables.
Decrease the default verbosity to bb.debug (level 1, so can be seen with
-D).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 lib/bb/runqueue.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 8fadc8338..adfe3c7a1 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -219,7 +219,7 @@ class RunQueueScheduler(object):
             pressure_state = (exceeds_cpu_pressure, exceeds_io_pressure, exceeds_memory_pressure)
             pressure_values = (round(cpu_pressure,1), self.rq.max_cpu_pressure, round(io_pressure,1), self.rq.max_io_pressure, round(memory_pressure,1), self.rq.max_memory_pressure)
             if hasattr(self, "pressure_state") and pressure_state != self.pressure_state:
-                bb.note("Pressure status changed to CPU: %s, IO: %s, Mem: %s (CPU: %s/%s, IO: %s/%s, Mem: %s/%s) - using %s/%s bitbake threads" % (pressure_state + pressure_values + (len(self.rq.runq_running.difference(self.rq.runq_complete)), self.rq.number_tasks)))
+                bb.debug(1, "Pressure status changed to CPU: %s, IO: %s, Mem: %s (CPU: %s/%s, IO: %s/%s, Mem: %s/%s) - using %s/%s bitbake threads" % (pressure_state + pressure_values + (len(self.rq.runq_running.difference(self.rq.runq_complete)), self.rq.number_tasks)))
             self.pressure_state = pressure_state
             return (exceeds_cpu_pressure or exceeds_io_pressure or exceeds_memory_pressure)
         elif self.rq.max_loadfactor:

-- 
2.47.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] doc: bitbake-user-manual-ref-variables: improve BB_PRESSURE_* doc
  2025-04-11 14:46 [PATCH 0/2] Improvements around BB_PRESSURE_* variables Antonin Godard
  2025-04-11 14:46 ` [PATCH 1/2] runqueue: decrease the verbosity of pressure messages Antonin Godard
@ 2025-04-11 14:46 ` Antonin Godard
  1 sibling, 0 replies; 6+ messages in thread
From: Antonin Godard @ 2025-04-11 14:46 UTC (permalink / raw)
  To: bitbake-devel; +Cc: docs, Thomas Petazzoni, Antonin Godard

The current default value for BB_PRESSURE_MAX_CPU is 500, which is
really low. Provide a value of 15000 which limits the load average
without being extremely slow either.

Provide similar values for BB_PRESSURE_MAX_IO and
BB_PRESSURE_MAX_MEMORY. Mention that these should be adjusted depending
on the need.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 .../bitbake-user-manual-ref-variables.rst          | 37 +++++++++++++++++++---
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
index 477443e22..3364e57a8 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -533,11 +533,18 @@ overview of their function and contents.
       version 4.20 expose under ``/proc/pressure``. The threshold represents
       the difference in "total" pressure from the previous second. The
       minimum value is 1.0 (extremely slow builds) and the maximum is
-      1000000 (a pressure value unlikely to ever be reached).
+      1000000 (a pressure value unlikely to ever be reached). See
+      https://docs.kernel.org/accounting/psi.html for more information.
 
-      This threshold can be set in ``conf/local.conf`` as::
+      A default value to limit the CPU pressure to be set in ``conf/local.conf``
+      could be::
+
+         BB_PRESSURE_MAX_CPU = "15000"
+
+      Multiple values should be tested on the build host to determine what suits
+      best, depending on the need for performances versus load average during
+      the build.
 
-         BB_PRESSURE_MAX_CPU = "500"
 
    :term:`BB_PRESSURE_MAX_IO`
       Specifies a maximum I/O pressure threshold, above which BitBake's
@@ -549,12 +556,22 @@ overview of their function and contents.
       version 4.20 expose under ``/proc/pressure``. The threshold represents
       the difference in "total" pressure from the previous second. The
       minimum value is 1.0 (extremely slow builds) and the maximum is
-      1000000 (a pressure value unlikely to ever be reached).
+      1000000 (a pressure value unlikely to ever be reached). See
+      https://docs.kernel.org/accounting/psi.html for more information.
 
       At this point in time, experiments show that IO pressure tends to
       be short-lived and regulating just the CPU with
       :term:`BB_PRESSURE_MAX_CPU` can help to reduce it.
 
+      A default value to limit the I/O pressure to be set in ``conf/local.conf``
+      could be::
+
+         BB_PRESSURE_MAX_IO = "15000"
+
+      Multiple values should be tested on the build host to determine what suits
+      best, depending on the need for performances versus I/O usage during the
+      build.
+
    :term:`BB_PRESSURE_MAX_MEMORY`
 
       Specifies a maximum memory pressure threshold, above which BitBake's
@@ -566,7 +583,8 @@ overview of their function and contents.
       version 4.20 expose under ``/proc/pressure``. The threshold represents
       the difference in "total" pressure from the previous second. The
       minimum value is 1.0 (extremely slow builds) and the maximum is
-      1000000 (a pressure value unlikely to ever be reached).
+      1000000 (a pressure value unlikely to ever be reached). See
+      https://docs.kernel.org/accounting/psi.html for more information.
 
       Memory pressure is experienced when time is spent swapping,
       refaulting pages from the page cache or performing direct reclaim.
@@ -574,6 +592,15 @@ overview of their function and contents.
       might be useful as a last resort to prevent OOM errors if they are
       occurring during builds.
 
+      A default value to limit the memory pressure to be set in
+      ``conf/local.conf`` could be::
+
+         BB_PRESSURE_MAX_MEMORY = "15000"
+
+      Multiple values should be tested on the build host to determine what suits
+      best, depending on the need for performances versus memory consumption
+      during the build.
+
    :term:`BB_RUNFMT`
       Specifies the name of the executable script files (i.e. run files)
       saved into ``${``\ :term:`T`\ ``}``. By default, the

-- 
2.47.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [docs] [PATCH 1/2] runqueue: decrease the verbosity of pressure messages
  2025-04-11 14:46 ` [PATCH 1/2] runqueue: decrease the verbosity of pressure messages Antonin Godard
@ 2025-04-11 19:09   ` Martin Jansa
  2025-04-15 11:52     ` Antonin Godard
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Jansa @ 2025-04-11 19:09 UTC (permalink / raw)
  To: antonin.godard; +Cc: bitbake-devel, docs, Thomas Petazzoni

On Fri, Apr 11, 2025 at 4:46 PM Antonin Godard via
lists.yoctoproject.org
<antonin.godard=bootlin.com@lists.yoctoproject.org> wrote:
>
> By default all the pressure changes are printed on the console and
> generate a lot of spam to users using the BB_PRESSURE_* variables.
> Decrease the default verbosity to bb.debug (level 1, so can be seen with
> -D).

Isn't "a lot of these messages" a proof that the BB_PRESSURE_*
variables aren't set correctly?

I find them quite useful and using -D by default in my builds would
bring even "more spam". But in worse case I'll just revert this for my
builds.

Cheers,

> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
>  lib/bb/runqueue.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
> index 8fadc8338..adfe3c7a1 100644
> --- a/lib/bb/runqueue.py
> +++ b/lib/bb/runqueue.py
> @@ -219,7 +219,7 @@ class RunQueueScheduler(object):
>              pressure_state = (exceeds_cpu_pressure, exceeds_io_pressure, exceeds_memory_pressure)
>              pressure_values = (round(cpu_pressure,1), self.rq.max_cpu_pressure, round(io_pressure,1), self.rq.max_io_pressure, round(memory_pressure,1), self.rq.max_memory_pressure)
>              if hasattr(self, "pressure_state") and pressure_state != self.pressure_state:
> -                bb.note("Pressure status changed to CPU: %s, IO: %s, Mem: %s (CPU: %s/%s, IO: %s/%s, Mem: %s/%s) - using %s/%s bitbake threads" % (pressure_state + pressure_values + (len(self.rq.runq_running.difference(self.rq.runq_complete)), self.rq.number_tasks)))
> +                bb.debug(1, "Pressure status changed to CPU: %s, IO: %s, Mem: %s (CPU: %s/%s, IO: %s/%s, Mem: %s/%s) - using %s/%s bitbake threads" % (pressure_state + pressure_values + (len(self.rq.runq_running.difference(self.rq.runq_complete)), self.rq.number_tasks)))
>              self.pressure_state = pressure_state
>              return (exceeds_cpu_pressure or exceeds_io_pressure or exceeds_memory_pressure)
>          elif self.rq.max_loadfactor:
>
> --
> 2.47.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#6736): https://lists.yoctoproject.org/g/docs/message/6736
> Mute This Topic: https://lists.yoctoproject.org/mt/112211584/3617156
> Group Owner: docs+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [docs] [PATCH 1/2] runqueue: decrease the verbosity of pressure messages
  2025-04-11 19:09   ` [docs] " Martin Jansa
@ 2025-04-15 11:52     ` Antonin Godard
  2025-04-15 12:07       ` Martin Jansa
  0 siblings, 1 reply; 6+ messages in thread
From: Antonin Godard @ 2025-04-15 11:52 UTC (permalink / raw)
  To: Martin Jansa; +Cc: bitbake-devel, docs, Thomas Petazzoni

Hi Martin,

On Fri Apr 11, 2025 at 9:09 PM CEST, Martin Jansa wrote:
> On Fri, Apr 11, 2025 at 4:46 PM Antonin Godard via
> lists.yoctoproject.org
> <antonin.godard=bootlin.com@lists.yoctoproject.org> wrote:
>>
>> By default all the pressure changes are printed on the console and
>> generate a lot of spam to users using the BB_PRESSURE_* variables.
>> Decrease the default verbosity to bb.debug (level 1, so can be seen with
>> -D).
>
> Isn't "a lot of these messages" a proof that the BB_PRESSURE_*
> variables aren't set correctly?
>
> I find them quite useful and using -D by default in my builds would
> bring even "more spam". But in worse case I'll just revert this for my
> builds.

I see how these messages can be useful.

To my understanding, having a low value for BB_PRESSURE_* variables will
generate a lot of these messages. To me, it does not necessarily mean that the
value isn't properly set, it just means that you want to limit the pressure a
lot.

Maybe the default behavior of printing everything is good for adjustments, I
just think it'd be convenient for user to have a way to disable those once they
are happy with their pressure configuration.

I thought first of a BB_PRESSURE_VERBOSE or BB_PRESSURE_QUIET variable. It
would just allow enabling/disabling these messages. But on second thought, I'm
not sure an extra variable is necessary when we could just move these messages
to debug messages. Other variables that limit the load do not generate such
"spam" (take BB_LOADFACTOR_MAX for example).

What do you think?

Antonin

--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [docs] [PATCH 1/2] runqueue: decrease the verbosity of pressure messages
  2025-04-15 11:52     ` Antonin Godard
@ 2025-04-15 12:07       ` Martin Jansa
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Jansa @ 2025-04-15 12:07 UTC (permalink / raw)
  To: Antonin Godard; +Cc: bitbake-devel, docs, Thomas Petazzoni

On Tue, Apr 15, 2025 at 1:52 PM Antonin Godard
<antonin.godard@bootlin.com> wrote:
>
> Hi Martin,
>
> On Fri Apr 11, 2025 at 9:09 PM CEST, Martin Jansa wrote:
> > On Fri, Apr 11, 2025 at 4:46 PM Antonin Godard via
> > lists.yoctoproject.org
> > <antonin.godard=bootlin.com@lists.yoctoproject.org> wrote:
> >>
> >> By default all the pressure changes are printed on the console and
> >> generate a lot of spam to users using the BB_PRESSURE_* variables.
> >> Decrease the default verbosity to bb.debug (level 1, so can be seen with
> >> -D).
> >
> > Isn't "a lot of these messages" a proof that the BB_PRESSURE_*
> > variables aren't set correctly?
> >
> > I find them quite useful and using -D by default in my builds would
> > bring even "more spam". But in worse case I'll just revert this for my
> > builds.
>
> I see how these messages can be useful.
>
> To my understanding, having a low value for BB_PRESSURE_* variables will
> generate a lot of these messages. To me, it does not necessarily mean that the
> value isn't properly set, it just means that you want to limit the pressure a
> lot.
>
> Maybe the default behavior of printing everything is good for adjustments, I
> just think it'd be convenient for user to have a way to disable those once they
> are happy with their pressure configuration.
>
> I thought first of a BB_PRESSURE_VERBOSE or BB_PRESSURE_QUIET variable. It
> would just allow enabling/disabling these messages. But on second thought, I'm
> not sure an extra variable is necessary when we could just move these messages
> to debug messages. Other variables that limit the load do not generate such
> "spam" (take BB_LOADFACTOR_MAX for example).

I guess you're using the default knotty where I agree that these
messages from pressure are more annoying, because there isn't much
else printed by default.

Most of my builds are on jenkins or run with tee, so I get a lot of
messages about e.g. starting and stopping tasks and almost never
notice the few pressure messages between them (unless it's IMHO badly
configured and changes regulation after almost every task).

> What do you think?

Do what you want (and others agree with) and I'll deal with it for my
builds if needed (I might just disable pressure regulation as I don't
find it that useful as it cannot prevent OOMK anyway and the task
granularity doesn't prevent it from triggering multiple heavy and log
do_compile tasks at the same time while the pressure was still low and
it gets overloaded shortly after - still hoping that
https://github.com/ninja-build/ninja/pull/2506 will be merged one
day).


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-15 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 14:46 [PATCH 0/2] Improvements around BB_PRESSURE_* variables Antonin Godard
2025-04-11 14:46 ` [PATCH 1/2] runqueue: decrease the verbosity of pressure messages Antonin Godard
2025-04-11 19:09   ` [docs] " Martin Jansa
2025-04-15 11:52     ` Antonin Godard
2025-04-15 12:07       ` Martin Jansa
2025-04-11 14:46 ` [PATCH 2/2] doc: bitbake-user-manual-ref-variables: improve BB_PRESSURE_* doc Antonin Godard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.