From: "Nate Kent" <yocto@nkent.net>
To: "Randy MacLeod" <randy.macleod@windriver.com>,
yocto@lists.yoctoproject.org
Subject: Re: [yocto] Limiting Yocto Memory Usage
Date: Tue, 21 Jul 2026 23:23:27 -0700 [thread overview]
Message-ID: <978937.1784701407866859454@lists.yoctoproject.org> (raw)
In-Reply-To: <f7c74a04-f5dc-4e09-8bae-65626db09dde@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2674 bytes --]
On Tue, Jul 21, 2026 at 05:22 PM, Randy MacLeod 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 ?
> Do you do world builds?
> Do you run more than one systemd-run build on a given machine?
I do this as a regular part of my development, though I tend to use '-S' ('-shell', essentially interactive mode) rather than spawning a unit just for a single build. I'll also often modify the resource constraints while BitBake is running if I need to reserve additional resources for non-BitBake tasks while a build is running. That being said, I generally do not do more than a single build at a time simply because reasoning about how to get two competing processes to maximize the usage of the system is a much more difficult challenge.
For theor the most my experience shows that it will work as you expect. If you give the slice three cores and it will act like building on a machine with just three cores, give it a low CPU weight and you'll get a build that's low priority to the scheduler, etc.
If you have other questions I can try to answer them but, for the most part, it's so painless and unsurprising that I don't really have much in the way of advice.
- Nate
PS: I'm sending this from the Yocto Mailing list website and I can't tell if it's going to send as "Github Flavored Markdown" + HTML or the plaintext that I'm typing. Apologies if this comes through mangled.
[-- Attachment #2: Type: text/html, Size: 2824 bytes --]
next prev parent reply other threads:[~2026-07-22 6:23 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 [this message]
2026-07-22 8:00 ` Ulrich Ölmann
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=978937.1784701407866859454@lists.yoctoproject.org \
--to=yocto@nkent.net \
--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