Yocto Project Discussions
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Randy MacLeod <randy.macleod@windriver.com>
Cc: yocto@lists.yoctoproject.org,  luis.merayo@ridgerun.com
Subject: Re: [yocto] Limiting Yocto Memory Usage
Date: Wed, 22 Jul 2026 10:00:41 +0200	[thread overview]
Message-ID: <6ra4rja1xy.fsf@pengutronix.de> (raw)
In-Reply-To: <f7c74a04-f5dc-4e09-8bae-65626db09dde@windriver.com> (Randy MacLeod's message of "Tue, 21 Jul 2026 11:22:31 -0400")

Hi Randy,

On Tue, Jul 21 2026 at 11:22 -0400, Randy MacLeod <randy.macleod@windriver.com> wrote:
> On 2026-07-16 04:22, Ulrich Ölmann via lists.yoctoproject.org wrote:
> >
> > Hey Luis,
> >
> > On Fri, Jul 10 2026 at 15:26 -0600, "Luis Merayo via lists.yoctoproject.org"<luis.merayo=ridgerun.com@lists.yoctoproject.org> 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=CPUWeight=<YOUR_CPUWEIGHT> \
> >         --property=IOWeight=<YOUR_IOWEIGHT> \
> >         --property=MemoryHigh=<YOUR_MEMORYHIGH> \
> >         --property=OOMPolicy=kill \
> >         --unit="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 good to
> hear that you're doing it.
>
> Do you have any experiences to share about this approach ?

we currently use the systemd-run approach mainly to make resource
sharing on our build servers a bit fairer between colleagues when
building customer BSPs.

One nice side effect is that every single process of the control group
gets terminated when the systemd-run scope is terminated. No stray
processes are left behind by mistake.

> Do you do world builds?

So far, I am not using it for world builds. Our use case is more about
encapsulating individual build jobs and avoiding that a single build
grabs too much of the machine, rather than stress-testing the setup with
"bitbake world".

> Do you run more than one systemd-run build on a given machine?

Yes, in practice we do end up with multiple builds running in parallel
on the same machine, since (hopefully ;) all colleagues use the same
systemd-run approach.

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

Right. For our purpose, though, it works reasonably well as a pragmatic
way to improve sharing/fairness on multi-user build machines.

Best regards,
Ulrich


> ../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 named 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 attachments, delete this email message and any
> >> attachments immediately.
> >>
> >>
> >>
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >> Links: You receive all messages sent to this group.
> >> View/Reply Online (#66645):https://lists.yoctoproject.org/g/yocto/message/66645
> >> Mute This Topic:https://lists.yoctoproject.org/mt/120272854/3616765
> >> Group Owner:yocto+owner@lists.yoctoproject.org
> >> Unsubscribe:https://lists.yoctoproject.org/g/yocto/unsub [randy.macleod@windriver.com]
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
>
> --
> # Randy MacLeod
> # Wind River Linux
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


      parent reply	other threads:[~2026-07-22  8:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 21:26 Limiting Yocto Memory Usage Luis Merayo
2026-07-14 21:33 ` [yocto] " Randy MacLeod
2026-07-28  7:30   ` Ferry Toth
2026-07-28 20:35     ` Ferry Toth
2026-07-28 21:20       ` Randy MacLeod
2026-07-28 21:36         ` Ferry Toth
2026-07-29 21:30           ` Randy MacLeod
2026-07-16  8:22 ` Ulrich Ölmann
2026-07-21 15:22   ` Randy MacLeod
2026-07-22  6:23     ` Nate Kent
2026-07-22  8:00     ` Ulrich Ölmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ra4rja1xy.fsf@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=luis.merayo@ridgerun.com \
    --cc=randy.macleod@windriver.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox