Re: [yocto] Limiting Yocto Memory Usage

Randy MacLeod <[email protected]> Tue, 21 Jul 2026 11:22:31 -0400
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
--------------KNiIBS67Vi7Wph0en8umA13l
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 66LDhps92891184

On 2026-07-16 04:22, Ulrich =C3=96lmann via lists.yoctoproject.org wrote:
> Hey Luis,
>
> On Fri, Jul 10 2026 at 15:26 -0600, "Luis Merayo via lists.yoctoproject=
.org"<[email protected]> wrote:
>> Hi,
>>
>> I would like to know if there is a way to limit Bitbake's Memory usage
>> to a specific percentage of the available RAM. For example, can the
>> Yocto build be limited to use a maximum of 70% of RAM?
> if you are doing your Bitbake work on a machine running a systemd based
> Linux distribution you could simply do something like
>
>    $ systemd-run \
>         --user \
>         --scope \
>         --property=3DCPUWeight=3D<YOUR_CPUWEIGHT> \
>         --property=3DIOWeight=3D<YOUR_IOWEIGHT> \
>         --property=3DMemoryHigh=3D<YOUR_MEMORYHIGH> \
>         --property=3DOOMPolicy=3Dkill \
>         --unit=3D"bitbake-run" \
>         bitbake [...]
>
> to somewhat limit the resources, see systemd.resource-control(5) and
> systemd.scope(5) for details regarding the used parameters.
>
> Best regards,
> Ulrich


Hi Ulrich,

Using systemd-run is something that I've been meaning to try so it's=20
good to hear that you're doing it.

Do you have any experiences to share about this approach ?
Do you do world builds?
Do you run more than one systemd-run build on a given machine?


Of course it doesn't prevent bitbake from pushing the cgroup contained=20
system
harder that it can handle and bitbake doesn't have any feedback so=20
that's something
to consider when doing the jobserver or free memory build regulation work.

../Randy


>
>
>> Could these three variables achieve this?
>>
>>   BB_PRESSURE_MAX_CPU, BB_PRESSURE_MAX_IO , BB_PRESSURE_MAX_MEMORY
>>
>> I see the range for these variables is from 1 to 1000000, so I would
>> like to understand if there is a way to specify their values as a
>> function of the available RAM.
>>
>> Regards,
>>
>> Luis
>>
>>
>> This email and any attachments are intended for the sole use of the na=
med recipient(s) and contain(s) confidential
>> information that may be proprietary, privileged, or copyrighted under =
applicable law. If you are not the intended
>> recipient, do not read, copy, or forward this email message or any att=
achments, delete this email message and any
>> attachments immediately.
>>
>>
>>
>> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#66645):https://lists.yoctoproject.org/g/yocto/mess=
age/66645
>> Mute This Topic:https://lists.yoctoproject.org/mt/120272854/3616765
>> Group Owner:[email protected]
>> Unsubscribe:https://lists.yoctoproject.org/g/yocto/unsub [randy.macleo=
[email protected]]
>> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
>>

--=20
# Randy MacLeod
# Wind River Linux

--------------KNiIBS67Vi7Wph0en8umA13l
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 66LDhps92891184

<!DOCTYPE html><html><head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
  </head>
  <head>

   =20
  </head>
  <body>
    <div class=3D"moz-cite-prefix">On 2026-07-16 04:22, Ulrich =C3=96lman=
n via
      lists.yoctoproject.org wrote:<br>
    </div>
    <blockquote type=3D"cite" cite=3D"mid:[email protected]">
      <pre wrap=3D"" class=3D"moz-quote-pre">Hey Luis,

On Fri, Jul 10 2026 at 15:26 -0600, &quot;Luis Merayo via lists.yoctoproj=
ect.org&quot; <a class=3D"moz-txt-link-rfc2396E" href=3D"mailto:luis.mera=
[email protected]">&lt;luis.merayo=3Dridgerun.com@=
lists.yoctoproject.org&gt;</a> wrote:
</pre>
      <blockquote type=3D"cite">
        <pre wrap=3D"" class=3D"moz-quote-pre">Hi,

I would like to know if there is a way to limit Bitbake's Memory usage
to a specific percentage of the available RAM. For example, can the
Yocto build be limited to use a maximum of 70% of RAM?
</pre>
      </blockquote>
      <pre wrap=3D"" class=3D"moz-quote-pre">if you are doing your Bitbak=
e work on a machine running a systemd based
Linux distribution you could simply do something like

  $ systemd-run \
       --user \
       --scope \
       --property=3DCPUWeight=3D&lt;YOUR_CPUWEIGHT&gt; \
       --property=3DIOWeight=3D&lt;YOUR_IOWEIGHT&gt; \
       --property=3DMemoryHigh=3D&lt;YOUR_MEMORYHIGH&gt; \
       --property=3DOOMPolicy=3Dkill \
       --unit=3D&quot;bitbake-run&quot; \
       bitbake [...]

to somewhat limit the resources, see systemd.resource-control(5) and
systemd.scope(5) for details regarding the used parameters.

Best regards,
Ulrich</pre>
    </blockquote>
    <p><br>
    </p>
    <p>Hi Ulrich,<br>
      <br>
      Using systemd-run is something that I've been meaning to try so
      it's good to hear that you're doing it.</p>
    <p>Do you have any experiences to share about this approach ?<br>
      Do you do world builds?<br>
      Do you run more than one systemd-run build on a given machine?<br>
      <br>
      <br>
      Of course it doesn't prevent bitbake from pushing the cgroup
      contained system&nbsp;<br>
      harder that it can handle and bitbake doesn't have any feedback so
      that's something<br>
      to consider when doing the jobserver or free memory build
      regulation work.</p>
    <p>../Randy</p>
    <p><br>
    </p>
    <blockquote type=3D"cite" cite=3D"mid:[email protected]">
      <pre wrap=3D"" class=3D"moz-quote-pre">


</pre>
      <blockquote type=3D"cite">
        <pre wrap=3D"" class=3D"moz-quote-pre">Could these three variable=
s achieve this?

 BB_PRESSURE_MAX_CPU, BB_PRESSURE_MAX_IO , BB_PRESSURE_MAX_MEMORY

I see the range for these variables is from 1 to 1000000, so I would
like to understand if there is a way to specify their values as a
function of the available RAM.

Regards,

Luis


This email and any attachments are intended for the sole use of the named=
 recipient(s) and contain(s) confidential
information that may be proprietary, privileged, or copyrighted under app=
licable law. If you are not the intended
recipient, do not read, copy, or forward this email message or any attach=
ments, delete this email message and any
attachments immediately.


</pre>
        <br>
        <fieldset class=3D"moz-mime-attachment-header"></fieldset>
        <pre wrap=3D"" class=3D"moz-quote-pre">-=3D-=3D-=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-
Links: You receive all messages sent to this group.
View/Reply Online (#66645): <a class=3D"moz-txt-link-freetext" href=3D"ht=
tps://lists.yoctoproject.org/g/yocto/message/66645">https://lists.yoctopr=
oject.org/g/yocto/message/66645</a>
Mute This Topic: <a class=3D"moz-txt-link-freetext" href=3D"https://lists=
.yoctoproject.org/mt/120272854/3616765">https://lists.yoctoproject.org/mt=
/120272854/3616765</a>
Group Owner: <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:yocto+o=
[email protected]">[email protected]</a>
Unsubscribe: <a class=3D"moz-txt-link-freetext" href=3D"https://lists.yoc=
toproject.org/g/yocto/unsub">https://lists.yoctoproject.org/g/yocto/unsub=
</a> [<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:randy.macleod@=
windriver.com">[email protected]</a>]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-

</pre>
      </blockquote>
    </blockquote>
    <p><br>
    </p>
    <pre class=3D"moz-signature" cols=3D"72">--=20
# Randy MacLeod
# Wind River Linux</pre>
  </body>
</html>

--------------KNiIBS67Vi7Wph0en8umA13l--